大家一定要先清除li的默認樣式,padding和margin。不然對緊接著的元素浮動和padding值有很大影響,會混亂。
2016-07-05
a:link,a:visited{color:#333;text-decoration:none;}
p{float:left;}
ul{margin:5px 10px;}
.two{background: url(http://img1.sycdn.imooc.com//53cf0fa20001d3dc00200032.jpg) no-repeat 0 -16px;}
</style>
然后再在結構中后面三個<em>加入class="two"
p{float:left;}
ul{margin:5px 10px;}
.two{background: url(http://img1.sycdn.imooc.com//53cf0fa20001d3dc00200032.jpg) no-repeat 0 -16px;}
</style>
然后再在結構中后面三個<em>加入class="two"
em{display:block;width:20px;height:16px;;color:#333;
float:left;text-align:center;
background: url(http://img1.sycdn.imooc.com//53cf0fa20001d3dc00200032.jpg) no-repeat;font-style:normal;}
li{list-style-type:none;overflow: hidden;
line-height:16px;margin-bottom: 14px;}
float:left;text-align:center;
background: url(http://img1.sycdn.imooc.com//53cf0fa20001d3dc00200032.jpg) no-repeat;font-style:normal;}
li{list-style-type:none;overflow: hidden;
line-height:16px;margin-bottom: 14px;}
<style type="text/css">
*{padding: 0px;margin:0px;}
div{border:1px solid #e8e8e8;width:300px;
height:180px;font-size:12px;margin:0 auto;}
*{padding: 0px;margin:0px;}
div{border:1px solid #e8e8e8;width:300px;
height:180px;font-size:12px;margin:0 auto;}
li{float:left;list-style-type:none;width:40px;height:30px;text-align: center;line-height: 30px;}
a:link,a:visited{color:#BE3948;display:block;text-decoration:none;}
a:hover{ color:#fff;display:block;background-color:#BE3948;text-decoration:none;}
a:link,a:visited{color:#BE3948;display:block;text-decoration:none;}
a:hover{ color:#fff;display:block;background-color:#BE3948;text-decoration:none;}
li{
list-style:none;
float:left;
}
a:link,a:visited{
display:block;
text-decoration:none;
color:#000;
width:48px;
height:30px;
line-height:30px;
text-align:center;
}
a:hover,a:active{
color:white;
background:#BD3948;
}
list-style:none;
float:left;
}
a:link,a:visited{
display:block;
text-decoration:none;
color:#000;
width:48px;
height:30px;
line-height:30px;
text-align:center;
}
a:hover,a:active{
color:white;
background:#BD3948;
}
CSS屬性的排列順序: L-V-H-A 。
L-V-H-A是link、visited、hover、active的簡寫。
它們分別表示
A:link 超鏈接的默認樣式
A:visited 訪問過的(已經看過的)鏈接樣式
A:hover 鼠標處于鼠標懸停狀態的鏈接樣式
A:active 當鼠標左鍵按下時,被激活(就是鼠標按下去那一瞬間)的鏈接樣式。
L-V-H-A是link、visited、hover、active的簡寫。
它們分別表示
A:link 超鏈接的默認樣式
A:visited 訪問過的(已經看過的)鏈接樣式
A:hover 鼠標處于鼠標懸停狀態的鏈接樣式
A:active 當鼠標左鍵按下時,被激活(就是鼠標按下去那一瞬間)的鏈接樣式。