2012-09-06 14 views

risposta

9

Nessuno degli <hr> elementi sono il primo figlio del loro elemento genitore.

Vedere this updated demo che rende il bordo più ovvio e sposta l'ora in alto.

Si potrebbe voler guardare :first-of-type che è nuovo in CSS 3 e fa quello che sembra essere alla ricerca di. (Posso usare suggests that it has wide support al di fuori di IE non corrente).

Vedere a demo using :first-of-type (che ho testato solo in Chrome).

+2

Sì, è così che ': first-of-type' è destinato ad essere utilizzato. – BoltClock

3

Perché #main 's first-child è un p, non un hr.

È possibile utilizzare nth-child però:

#main hr:nth-child(2) { 
    border-bottom: 3px solid green; 
} 
Problemi correlati