Target first 5 nth children using :nth-child(n+2)::before - HTML CSS CSS Selector

HTML CSS examples for CSS Selector:nth-child

Description

Target first 5 nth children using :nth-child(n+2)::before

Demo Code

ResultView the demo in separate window


<html>
 <head> 
  <style>
a {<!-- w  w  w . j a v  a  2 s . c om-->
   display:block;
}

a:nth-child(n+1)::before
 {
   content:"? ";
}

a:nth-child(n+2)::before
 {
   content:"?? ";
}

a:nth-child(n+3)::before
 {
   content:"??? ";
}

a:nth-child(n+4)::before
 {
   content:"???? ";
}

a:nth-child(n+5)::before
 {
   content:"????? ";
}
</style> 
 </head> 
 <body> 
  <a href="#">Lore</a> 
  <a href="#">Lore</a> 
  <a href="#">Lore</a> 
  <a href="#">Lore</a> 
  <a href="#">Lore</a>  
 </body>
</html>

Related Tutorials