Friday, April 28, 2023
HomeProgrammingCSS content-visibility

CSS content-visibility


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 utilize .container > * to cover all contents of a container, however what if there was a greater manner?

There’s a higher approach 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 by utilizing content-visibility: hidden is a lot nicer from a upkeep perspective!

  • Convert XML to JSON with JavaScript
  • Create Namespaced Classes with MooTools

    MooTools has at all times gotten a little bit of grief for not inherently utilizing and standardizing namespaced-based JavaScript lessons just like the Dojo Toolkit does.  Many builders create their lessons as globals which is usually frowned up.  I largely disagree with that stance, however every to their very own.  In any occasion…

  • Highlight Table Rows, Columns, and Cells Using MooTools 1.2.3

    Row highlighting and particular person cell highlighting in tables is fairly easy in each browser that helps :hover on all parts (principally every little thing besides IE6). Column highlighting is a little more troublesome. Fortunately MooTools 1.2.3 makes the method simple. The XHTML A standard desk. The cells…

  • Use Custom Missing Image Graphics Using MooTools

    Lacking photos in your web site could make you or your corporation look fully novice. Sadly typically a picture will get deleted or corrupted with out your data. You’d agree with me that IE’s default “crimson x” icon seems to be terrible, so why not use your personal lacking picture graphic? The MooTools JavaScript Observe that…


RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments