2016-09-21 75 views
-3

我有很多垂直線在<a>鏈接之前,但我想隱藏第三行。顯示:無僞元素?

這裏是我的CSS我<a>前:

.header-social a:before { 
//line style 
} 

我一直在使用nth-child()嘗試過,但我不知道如何使用僞元素與nth-child()

.header-social a:before:nth-child(4) { 
    display:none; 
} 

不知道我怎麼能進入比我已經有的任何更多的細節。我需要JavaScript嗎?

+0

把你完整的代碼在這裏。 – JeetDaloneboy

+0

你可以顯示你的html結構嗎?您需要社交網絡上的第n個孩子 – Pete

+0

如果沒有您的HTML,我們只能提供(受過教育的)猜測。 –

回答

2

這樣做:

.header-social a:nth-child(3)::before { 
    color: red; 
} 

或使用nth-of-type

.header-social a:nth-of-type(3)::before { 
    color: red; 
} 
+0

工作正常,但我想讓社交欄的其餘部分對齊中心,就好像該行根本不存在一樣。在那一刻,它似乎更像是它的隱藏,而不是實際上消失了。我知道如何刪除jQuery中的某些東西,但這是一個僞元素,所以我不能使用這個: $(「.header-social a:before」).remove(); –