Welcome to the Treehouse Community
Looking to learn something new?
Lars Jönsson2,965 Points
Nth child selector
I got a problem, im trying to get some padding on some icons by writing:
img:nth-child(1n+2) @include xlarge border: 1px solid black padding-right: 5%
It should add padding as you see. But i dont work. Only by replacing 1n+2 by odd. Then it selects all the elements, and thats not exactly correct either. When i replace odd with even nothing happens.
I know that the code a write first is correct, it must be... or? :D
This is the HTML:
#author-bio .place-left .author-pic img(src="assets/img/3.svg") .author-media a(href="#") img(src="assets/img/facebook.svg") a(href="#") img(src="assets/img/youtube.svg") a(href="#") img(src="assets/img/instagram.svg")
And the CSS:
.author-media padding-top: 5% @include xlarge padding-top: 10% img width: 48px height: 48px @include xlarge width: 38px height: 38px img:nth-child(odd) @include xlarge border: 1px solid black padding-right: 5%
I want to select img 1 and 2.
I'm using JADE and SASS by the way.