我納悶為啥inline能設置寬高,后來想到浮動會把元素轉換成inline-block元素。= =好吧。設置<i>的inline與<li>的block意義在哪。。
2015-12-03
*{margin:0;padding:0;}
ul{list-style;none;}
li h3{font-size:14px;font-weight:400;text-align:center;}
li{display:block;width:130px;height:31px;line-height:31px;overflow:hidden;border-bottom:1px solid #dedede;margin:0 auto;}
.cat{width:150px;background:#f8f8f8;border:1px solid #bbb;}
ul{list-style;none;}
li h3{font-size:14px;font-weight:400;text-align:center;}
li{display:block;width:130px;height:31px;line-height:31px;overflow:hidden;border-bottom:1px solid #dedede;margin:0 auto;}
.cat{width:150px;background:#f8f8f8;border:1px solid #bbb;}
.cat-1 i{background-position:0 0;}
.cat-2 i{background-position:0 -24;}
.cat-3 i{background-position:0 -48;}
.cat-4 i{background-position:0 -72;}
.cat-5 i{background-position:0 -96;}
.cat-6 i{background-position:0 -120;}
.cat-7 i{background-position:0 -144;}
.cat-8 i{background-position:0 -168;}
.cat-2 i{background-position:0 -24;}
.cat-3 i{background-position:0 -48;}
.cat-4 i{background-position:0 -72;}
.cat-5 i{background-position:0 -96;}
.cat-6 i{background-position:0 -120;}
.cat-7 i{background-position:0 -144;}
.cat-8 i{background-position:0 -168;}
因為用過雪碧圖,正好1個小時,就點進來看,老師確實帥呆了。http://www.spritecow.com/這個網址用起來還不錯。
2015-12-02
在li i中添加一句background
.cat-2 i{background-position:0 -24px;}
.cat-3 i{background-position:0 -72px;}
.cat-4 i{background-position:0 -96px;}
.cat-5 i{background-position:0 -120px;}
.cat-6 i{background-position:0 -144px;}
.cat-7 i{background-position:0 -168px;}
.cat-8 i{background-position:-40px 0;}
.cat-2 i{background-position:0 -24px;}
.cat-3 i{background-position:0 -72px;}
.cat-4 i{background-position:0 -96px;}
.cat-5 i{background-position:0 -120px;}
.cat-6 i{background-position:0 -144px;}
.cat-7 i{background-position:0 -168px;}
.cat-8 i{background-position:-40px 0;}