将一个p覆盖在另一个p上有两种手段:一是设置margin为负值,二是设置绝对定位。
可以根个人情况设置z-index的值
1->position 为absolute的情况
<style>
#p1{position:absolute;width:300px;height:300px;background:#ccc;}
#p2{position:absolute;left:0;top:0;width:200px;height:200px;background:red;filter:alpha(opacity=50);}
</style><pid>这里是p1的内容
<pid></pid></pid>
2->用margin为负的操作
<style>
#p1 {position:relative; width:300px; height:300px;background:#ccc;}
#p2 {position:relative; left:0; top:0;margin-top:-15px;width:200px; height:200px; background:red;filter:alpha(opacity=50);}
</style><pid> 这里是p1的内容
<pid></pid></pid>
前端入门到VUE实战笔记:立即使用
在学习笔记中,你将探索 前端 的入门与实战技巧!











