Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apply a CSS effect to only the first 10 <a> tags of a div

How to apply a CSS effect to the first 10 <a> tags of a div?

This is my approach, but I believe there has to be a better solution:

a:nth-child(1), a:nth-child(2), a:nth-child(3), a:nth-child(4),
a:nth-child(5), a:nth-child(6), a:nth-child(7), a:nth-child(8),
a:nth-child(9), a:nth-child(10){ color:#4faacb; }
like image 418
sanchitkhanna26 Avatar asked Apr 29 '13 13:04

sanchitkhanna26


1 Answers

I believe this CSS should do the trick

a:nth-child(-n+10) { color: #4faacb }

JSFiddle

Hope this helps

like image 124
Titouan de Bailleul Avatar answered Sep 28 '22 12:09

Titouan de Bailleul