Home >Web Front-end >HTML Tutorial >css makes two divs overlap
When I was making a web page, I put a weather plug-in from another web page in p, but when I clicked it, it would jump to the advertising page. I wanted to find a way to prohibit clicks on p on the Internet, but I found that there is no such method. I used the js method. It didn't seem to be successful. Later I thought it would be better to use two overlapping layers to prevent clicks, although positioning is a bit troublesome
<p style="position:relative"> <p style="position:absolute;left:0;top:0"> </p> <p style="position:absolute;left:0;top:0"> </p> </p>
relative means relative positioning. Absolute is absolute positioning. It's amazing that it won't work without one of them, but when put together, two p's in one p can overlap. www.w3school.com.cn/css/css_positioning.asp Here are some instructions on css positioning in w3school
z-index:1 This determines the display order of two layers together, z-index The default value is 0, which is suitable for use when there are many layers