老师请看一下这是什么问题
来源:5-2 编程练习
慕斯卡3102410
2020-01-08 14:46:00
<html> <head> <style type="text/css"> #one{ width: 100px; height: 100px; background: red; /* 请在此添加代码*/ float:left; z-index: 2; } #two{ width: 100px; height: 100px; background: green; /* 请在此添加代码*/ position:absolute; top:25px; left:25px; z-index: 1; } </style> </head> <body> <div id="one"> </div> <div id="two"> </div> </body> </html>
2回答
同学你好,z-index 是要在定位元素上奏效。修改后代码如下:
如果我的回答解决了你的疑惑,请采纳!祝学习愉快!
慕斯卡3102410
提问者
2020-01-08
z-index是要在绝对位置上才能使用吗
相似问题