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 Favourite 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…
Utilizing MooTools to Instruct Google Analytics to Monitor Outbound Hyperlinks
Google Analytics offers a wealth of details about who’s coming to your web site. Some of the necessary statistics the service offers is the referrer statistic — you’ve got gotta know who’s sending individuals to your web site, proper? What about the place you ship others although?
[ad_2]