Web page design css_9. z-index and display

One, z-index

Let’s look at an example before we talk about this z-index

As you can see, we let the two div blocks be positioned, and they are offset based on this browser, but we can find that there is one div missing. This div actually exists, and the reason is not displayed. Was overwritten

If we want a2 to be displayed below, we have to move the order of the div blocks. How to make a2 display below without changing the html code, here we need to use z-index, let’s try it

We set a z-index for the a1 block so that the a1 block can be displayed on it.

This z-index can change the vertical space position of the label and the label, the higher the number, the first display

Two, display

This display is used to modify the nature of the element, like a div block. Originally, div is a block-level element. We can modify the display to make this div program a row-level element

Directly on the example

We set a display for a1 and set it to inline

We can see that there is nothing left. This is not that the display deletes them, but that after these two div blocks are programmed with row-level elements, because there are no values, there is no way to display them. We only need to get a few for the div blocks. Value

Has it become a row-level element?

Of course, we can also turn this row-level element into a block-level element

Here, we can modify it to block

 

This blog ends here, the next article starts to talk about this jQuery, if you have any questions, please contact me QQ: 2100363119

Welcome everyone to visit my own website: https://www.lemon1234.com

Guess you like

Origin blog.csdn.net/weixin_45908370/article/details/108948718