Hacker News new | ask | show | jobs
by 0df8dkdf 1975 days ago
There is a difference between dispaly and visible in CSS. One just hides the element but doesn't rearrange the other elements around it, the other display as if the element doesn't exist.

https://www.tutorialrepublic.com/css-tutorial/css-visibility...

2 comments

In addition, visibility may participate in animations. In particular we can delay the transition of visibility to false, but not of display to hidden. So it is very helpful in some pure-CSS disappearance animations, such as fading out a modal's background overlay.
I just learned something today, and I do CSS (amongst other things) for a living. Maybe it should be visible: true|false|ghost
Seriously, never had to deal with visibility:hidden before? To quote the Pythons: You lucky, lucky bastard....
It’s kind of unusual to set visibility to hidden in CSS, it’s more something you’d code in jQuery, or handle in the React code itself.
If you've never before seen this hack consider yourself privileged to been born in a better world, without IE6 :P

.clearfix:after {

  visibility: hidden;

  display: block;

  font-size: 0;

  content: " ";

  clear: both;

  height: 0;

}