This question already has an answer here:
I want to know what does (~) mean in css.
#img1:hover ~ #img2 {
opacity: 0;
}
In visual studio, i get 'unexpected character sequence' error when i use this symbol. what is the actual meaning of this in CSS. what does it do?
It applies the style to all elements matching the second selector if they appear after the elements matching the first selector. For example, given an HTML snippet:
and a CSS rule:
only
<p>Line two</p>
and<p>Line three</p>
will appear bold. In your example, I think Visual Studio is having a problem interpreting the:hover
modifier, since it isn't really an element. If you remove it from the rule, it may work correctly.http://www.w3.org/TR/selectors/
example
matches that
<pre>
here:There is also
+
selector, for adjacent sibling combinator: withh1 + pre
the<pre>
tag would have to be right after<h1>