div是块级元素,主要用作大的框架布局,比如将网页划分左中右结构。
也就是说网页的骨架主要通过div来架设的,而网页的血肉则是有span、p或者ul等元素完成。
代码实例如下:
```html
蒲公英云body{background:#ffcc99;}
#header {
margin:0px auto;
width:1000px;
height:100px;
background:#FFFFCC;
}
#menu {
margin:5px auto;
width:1000px;
height:30px;
line-height:30px;
color:#99FF99;
font-weight:bold;
font-size:14px;
background:#6699FF;
}
#content {
margin:5px auto;
width:1000px;
height:400px;
background-color:#cccccc;
}
.content_left {
float:left;
width:200px;
height:400px;
background:#cc99ff;
}
.content_center {
float:left;
width:590px;
height:400px;
margin-left:5px;
background:#cc99ff;
}
.content_right {
float:left;
width:200px;
height:400px;
margin-left:5px;
background:#cc99cc
}
#footer1 {
margin:5px auto;
background-color:#5185E6;
color:#FFFFFF;
border-top:0px solid #F7F7F6;
height:30px;
line-height:30px;
width:1000px;
padding:5px 0;
text-align:center;
}
#footer2 {
margin:5px auto;
background-color:#3333FF;
color:#FFFFFF;
border-top:0px solid #F7F7F6;
height:30px;
line-height:30px;
width:1000px;
padding:5px 0;
text-align:center;
}
a{text-decoration:none;}
```