您的位置:首页 > 其它

div相对定位与绝对定位

2014-01-21 15:08 148 查看
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>绝对定位相对定位</title>
<style>
* { margin: 0; padding: 0; }
.fj1 { width: 150px; position: relative; height: 150px; border: 1px solid #000; background: #999; margin: 0 auto; }
.zj1{ width: 50px; height: 50px; position: absolute; right: 5px; top: 20px; border: 1px solid #F00; background: #FFF; z-index: 3 }
</style>
</head>

<body>

<div class="fj1"> 我在下面
<div class="zj1">我浮动在上面</div>
</div>
</body>
</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: