Home Software Development CSS content-visibility

CSS content-visibility

0
CSS content-visibility
[ad_1]

The CSS language is stuffed with small gaps that are irritating to navigate. Between CSS properties to cover a container and its contents, there’s nonetheless room for enchancment. visibility: hidden retains peak and width integrity whereas show: none on a container hides every little thing. You should use .container > * to cover all contents of a container, however what if there was a greater manner?

There’s a higher method to cover the contents of a component whereas respecting the container’s border and dimensions. That higher manner is utilizing the content-visibility property:

.my-container.contents-loading {
  content-visibility: hidden;
}

A demo of such performance:

See the Pen Untitled by David Walsh (@darkwing) on CodePen.

Avoiding a .container > * selector through the use of content-visibility: hidden is a lot nicer from a upkeep perspective!

  • Chris Coyier’s Favorite CodePen Demos

    David requested me if I might be up for a visitor submit selecting out a few of my favourite Pens from CodePen. A frightening activity! There are such a lot of! I managed to choose a number of although which have blown me away over the previous few months. For those who…

  • From Webcam to Animated GIF: the Secret Behind chat.meatspac.es!

[ad_2]