Reputation: 854
Using SCSS and have a nested element which I am trying to nest an nth-of-type()
rule into but it hasn't worked anyway I type it. I want every odd el_header
element to be white text and every even one to be black.
.el {
height: 500px;
width: 500px;
&_header {
height: 100%;
width: 10%;
background: #555;
display: inline-block;
line-height: 500px;
text-align: center;
&nth-of-type(odd) {
color: black;
}
&nth-of-type(even) {
color: white;
}
}
}
Upvotes: 1
Views: 8512
Reputation: 1368
You just forgot the :
after &
.
Use
&:nth-of-type(odd){...}
&:nth-of-type(even){...}
and it will work. See updated fiddle
Upvotes: 9