Description
p:nth-of-type(2)
/* Selects every <p> element that is the second <p> element of its parent */
p ~ ul
/* Selects every <ul> element that are preceded by a <p> element */
I often use those 2 selectors in CSS stylesheet.
But I did not know about this correctly.
So I would like to share about my fault here with all of us.
div:nth-of-type(2n){
background-color: red;
}
.c ~ .c {
background-color:blue;
}
.d ~ .c {
background-color:green;
}
Top comments (0)