Layering elements with z-index – Web design tutorial (using the Old UI)

Even for 2D parts, our third dimension, the z-axis, represents stacking say. In other terms, what aspects stack or overlapon top of other components? Modifications to z-index don’t actually move ourelements. This isn’t dominant real degree. But z-index does help us position elementswhen we stack them. Virtually, constituents with a higher a z-indexvalue show up on top of elements with a lower z-index price. There are some caveats: If “were having” two elements( each of these elements has children ), z-index will limit stackingfor those parent aspects. But if part A has a higher z-index thanelement B? The children of element B can never overlapany part of element A.Even if the z-index is 700 billion. Let’s look at this in the Designer. Three div blocks, side-by-side. Our intention here is to have the midriff divblock overlap the outside div blocks. The ordinary stacking lineup here is that thefirst one is on the bottom; the second one is above that, and the third is above that. Let’s select the middle div block, which isset to relative positioning( keep in mind that z-index is only available on relative, absolute, and deposited ranking ). And let’s set the z-index to 1. Now it stacks on top! That’s because the default z-index is zero. Keep in spirit that providing the z-index to anegative evaluate means we could lose element visibility because it’ll get yielded underneathmost elements.Let’s adopt the left one and set the z-indexto 2. What’s going to happen? Well, like we learned in AP Calc, 2 is greaterthan 1. So of course, it’ll stack above. Let’s select the right one. Set it to 2 as well. Or 3. Doesn’t matter. It’s greater than the middle div block whichis set to a z-index of 1. If we designate our midriff chap to 4? You get the idea. So, Z-index. We can control the stacking order of elements, with higher prices stacking on top of lower importances ..


As found on YouTube

Share this article

Leave a comment

Related Posts