Created
August 3, 2017 15:56
-
-
Save mfyance/07b5b501f54a6b86d6eea7de95f93420 to your computer and use it in GitHub Desktop.
Detectando cantidad de hijos
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
li { | |
float: left; | |
} | |
/* one item */ | |
li:first-child:nth-last-child(1) { | |
width: 100%; | |
} | |
/* two items */ | |
li:first-child:nth-last-child(2), | |
li:first-child:nth-last-child(2) ~ li { | |
width: 50%; | |
} | |
/* three items */ | |
li:first-child:nth-last-child(3), | |
li:first-child:nth-last-child(3) ~ li { | |
width: 33.3333%; | |
} | |
/* four items */ | |
li:first-child:nth-last-child(4), | |
li:first-child:nth-last-child(4) ~ li { | |
width: 25%; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment