Home  >  Article  >  Web Front-end  >  css makes two divs overlap

css makes two divs overlap

PHP中文网
PHP中文网Original
2017-06-07 09:23:563278browse

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

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn