HTML下使元素在父元素内绝对定位

来源:互联网 发布:查看网络攻击的网站 编辑:程序博客网 时间:2024/06/02 19:26
<!DOCTYPEhtml>
<html>
<head>
<title>TestPosition</title>
<styletype="text/css">
*{font-family: arial;margin: 5px;border: solid 1px blue;}
 #box1{width: 400px; height: 400px; display: block; border: solid 2px #1FAA33; z-index: 98;position:relative;}
 #box2{width:30px ;height: 30px;background-color: lime;display: block;position: absolute;z-index: 99; left: 30px; bottom: 30px; border-color: #EE3399;}
</style>
</head>
<body>
<div id="box1">父元素
<div id="box2">子元素</div>
</div>
</body>
</html>
0 0
原创粉丝点击