-
-
Save matiasemily/2660bbb772a24c9995979c8f91e93db8 to your computer and use it in GitHub Desktop.
Usando :nth-child
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
elemento-pai :nth-child(n) { | |
/* Estilos para o enésimo filho */ | |
} | |
/* Exemplo: */ | |
ul li:nth-child(2) { | |
background-color: yellow; | |
} | |
elemento-pai :nth-child(an + b) { | |
/* Estilos para os elementos que atendem à fórmula an + b */ | |
} | |
/* Exemplo: */ | |
ul li:nth-child(3n + 2) { /* n+3 a partir de 2, ou seja: 2, 5, 8, 11... */ | |
color: blue; | |
font-weight: bold; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment