+ 我要发布
我发布的 我的标签 发现
浏览器扩展
斑点象@Edge

如何让一个DIV完全覆盖另一个DIV

直接上示例代码(通过定位来解决这个问题) id为v2的div直接覆盖到id为v1的div上。 其中v1重要的style是 “float: right;” v2重要的style是 “position: absolute; z-index: 1;” <div> <div id="v1" style="float: right; width: 100%; padding:0 0 0 5rem; margin: 0;"></div> <div id="v2" style="width: 4rem; height: 4rem; background-color:red; position: absolute; z-index: 1; "></div> <div style="clear: both;"></div> </div> 为了不影响其他元素的布局,需要设置 <div style="clear: both;"></div>
CSS
我的笔记