從最簡單的開始寫,今天使用UL LI標簽寫footer頁面,主要的思想是用ul li寫三個列表,浮動,然后在每個li標簽里面再嵌套一個ul li標簽,這里我發現了一個現象,當我把每一個li標簽設置了高度之后,整一個大的ul標簽就也跟著有高度了,然后這個浮動的大的ul標簽的后端沒有設置清除浮動的時候,居然也不會影響整個頁面的布局,這個現象值得注意!前提是你這個浮動的元素的子元素有明確高度的情況下。
代碼如下
CSS:
@charset "utf-8";
*{
margin: 0;
padding: 0;
color: #bababa;
font-size: 14px;
}
ul li{
list-style: none;
}
a{
text-decoration: none;
}
.clearfix{
clear: both;
}
.wt1170{
width: 1170px;
margin: 0 auto;
}
.footer{
background: #373939;
height: 300px;
}
.wt1170 ul{
margin-top: 50px;
}
.wt1170 li{
display: block;
}
.wt1170 .l1{
width: 270px;
padding-bottom: 10px;
border-bottom: 1px solid #fff;
font-size: 22px;
margin-top: 0;
}
.wt1170 .u1,.wt1170 .u2{
margin-right: 180px;
}
.u1,.u2,.u3{
float: left;
}
.u1 li,.u2 li,.u3 li{
/*width: 270px;*/
margin-top: 12px;
}
.l1-01,.l1-02,.l1-03{
height: 32px;
line-height: 32px;
}
.footer-bottom{
height: 30px;
line-height: 30px;
background: #000000;
text-align: center;
}
.l1-01{
padding-left: 40px;
background:url(../img/001.png) no-repeat;
}
.l1-02{
padding-left: 40px;
background:url(../img/002.png) no-repeat;
}
.l1-03{
padding-left: 40px;
background:url(../img/003.png) no-repeat;
}
.l2{
height: 16px;
line-height: 16px;
}
.l2:before{
content: url(../img/icon-before.png);
}