Darren Vong
Posted on September 1, 2019
When was the last time you see the z-index
CSS property being used like so:
.some-element {
z-index: 99999999;
}
Now suppose you want another element to be displayed above the element with the "some-element" class, a quick and dirty (yet seemingly common!) fix for this is by adding another '9' at the end of the z-index value above and apply it to this other element. For bigger web apps, this can quickly become unmanageable.
Since the default ordering is determined by the order of the HTML markup, with the element nearest the bottom appearing on top, shouldn't we use that instead of z-index? Can you think of a use case where relying on the markup's order alone is insufficient?
Posted on September 1, 2019
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.