一、DIV定义
<div id="" class="" style ="">
块包含的内容
</div>
二、DIV嵌套
<div id="wrap" class="" style ="">
<div id="d1">div1</div>
<div id="d2">div2</div>
<div id="d3">div3</div>
</div>
三、DIV层叠
<!-- edu_8_2_2.html -->
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style type="text/css">
body{margin:0; /*margin表示边距,在8.5CSS盒模型介绍*/}
div{position:absolute; /* 定位方式为绝对定位 */
width:200px;height:200px;}
#d1{background-color:black;
z-index:0; /* 该图层在最下面 */color:white;}
#d2{background-color:red;top:25px;left:50px;z-index:1; /*图层在中间 */}
#d3{background-color:yellow;top:50px;left:100px;
z-index:2; /* 该图层在最上面 */}
</style>
</head>
<body>
<div id="d1" >div1</div>
<div id="d2" >div2</div>
<div id="d3" >div3</div>
</body>
</html>
网友评论