Home  >  Article  >  Web Front-end  >  css 让两个div重叠

css 让两个div重叠

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

做网页的时候在p里放了一个别的网页的天气插件,但是点击了会跳到广告页面的,想去网上找个禁止p点击的方法,可是发现没有,用了js的方法好像也没有成功,后来觉得还是用两个层重叠的方法来阻止点击,虽然定位是有点麻烦

relative是相对定位的意思。absolute是绝对定位,很奇妙少了一个都不行,但是放在一起就可以实现一个p中两个p重叠在一起。www.w3school.com.cn/css/css_positioning.asp这里是w3school里关于css的定位的一些说明

z-index:1 这个是决定两个层在一起的显示顺序,z-index的默认值是0,适合层多的时候用

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