關1像素邊框
.itemList?li{ width:?95%; height:?45px; margin-left:?5%; /*?border-bottom:?1px?solid?#d1d1d1;?*/ color:?#666; font-size:?14px; line-height:?45px; padding:?0; margin-bottom:?-1px; list-style:?none; } .itemList?li?+?li:before{ position:?absolute; /*?top:?-1px;?*/ /*?left:?0px;?*/ content:?''; width:?100%; height:?1px; border-top:?1px?solid?#d1d1d1; -webkit-transform:?scaleY(0.5); }
以上是我的css代碼,ul中有四個li,只有第二個li出現了邊框,請問這是什么原因呢?截圖如下:
2016-01-07
我解決了,是我在ul中嵌套了div所以找不到同級li,直接用.itemList li:before來設置偽類就行了。很感謝老師提供的方法,我試過很多方法,現在終于解決了。感謝
2016-01-07
按照你的代碼第2,3,4個li都會出現邊框,要是3,4沒有邊框,應該是其他代碼沖突了