2017-06-29 60 views

回答

1

刪除:first-child ...之前的空間!

.social-share li:first-child {background-color: yellow;}
<ul class="social-share"> 
 
<li>Item 1</li> 
 
<li>Item 2</li> 
 
<li>Item 3</li> 
 
</ul>

1

應該有li: & first child 之間沒有空格應該是這樣

.social-share li:first-child { 
    background-color: yellow; 
} 
+0

你爲什麼低估我? – somethingnow

+1

我向你投了贊。我沒有降低你的評價 – Soumya

2

請檢查該演示:

.social-share li:first-child{background-color: yellow;}
<div class="social-share"> 
 

 
<ul> 
 
<li>First</li> 
 
<li>Second</li> 
 
</ul> 
 

 
</div>