假设我有一些文件
#a{width: 10px; height: 10px; background: red; z-index: 10;}
#b{width: 100%; height: 100%; background: black; z-index: 5; position: absolute;}
Run Code Online (Sandbox Code Playgroud)
<body>
<div id="a">foo</div>
<div id="b">bar</div>
<body>
Run Code Online (Sandbox Code Playgroud)
覆盖#b div
,#a
因为#b
有absolute
位置。
如何在不改变#a位置的情况下强制#b
落后#a
?