general sibling selector

Solutions on MaxInterview for general sibling selector by the best coders in the world

showing results for - "general sibling selector"
Mel
26 May 2018
1/* The general sibling combinator (~) separates
2two selectors and matches the second element 
3only if it follows the first element 
4(though not necessarily immediately), 
5and both are children of the same parent element. */
6
7/* Paragraphs that are siblings of and
8   subsequent to any image will be red */
9
10img ~ p {
11  color: red;
12}
13
14<img src="myimg.png"/>
15<p>This will be red!</p>
16