📜 ⬆️ ⬇️

What nobody told you about z-index in the article “What nobody told you about z-index”

image
Almost two years ago, the article “ What no one told you about z-index ” (and its translation on Habré “ What nobody told you about z-index ”) was published, the authors of which tell about the little-known ( 76% of Habr's users who heard about this for the first time ), but the documented ability to create a new context overlay by specifying an opacity less than one.

But despite the title of the article, the authors did not tell you about something else.

It is assumed that you are familiar with the concept of overlay context.
Elements with common parents moving to the foreground or background together are known as the overlay context . Understanding the context of the overlay is the key to understanding the z-index and the order of the overlay elements.
')
Each overlay context has its root element in the HTML structure. At the time of the formation of a new context on the element, all the child elements also fall into this context and take their place in the overlay order. If an element is located at the very bottom of a single overlay context , then it will not be possible in any conceivable and inconceivable way to display it over another element in the adjacent overlay context , which is higher in the hierarchy, even with the z-index equal to a million.
- From the article “ What nobody told you about the z-index ”. To understand the topic, I strongly recommend that you either get acquainted with her or the classic work on MDN .

New context overlay is formed in the following cases:

Source: https://habr.com/ru/post/225721/


All Articles