我是這樣子寫的、可以參考一下
.topList{
? ? width:300px;
? ? height:180px;
? ? border:1px solid #E8E8E8;
? ? margin:0 auto;
}
.topList ul{
? ? list-style-type:none;
? ? padding:5px;
? ? font-size:12px;
? ? margin-top:-5px;
}
em{
? ? width:20px;
? ? height:16px;
? ? text-align:center;
? ? font-style:normal;
? ? color:#333;
? ? background:url(http://img1.sycdn.imooc.com//53cf0fa20001d3dc00200032.jpg) no-repeat bottom center;
? ? display:block;
? ? float:left;
}
.top em{
? ? color:#FFF;
? ? background:url(http://img1.sycdn.imooc.com//53cf0fa20001d3dc00200032.jpg) no-repeat top center;
}
.topList a:link,.topList a:visited{
? ? text-decoration: none;
? ? color: #888;
}
.topList a:hover,.topList a:active{
? ? text-decoration: none;
? ? color: #F00;
}
2019-04-28
為什么不設(shè)置margin-top:-5px;文字就偏離邊框了?前面空出的幾行咋產(chǎn)生的?