(〜)是什么意思在CSS

前端之家收集整理的这篇文章主要介绍了(〜)是什么意思在CSS前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
参见英文答案 > What does the “~” (tilde/squiggle/twiddle) CSS selector mean?4个答案我想知道什么(〜)意思在css。
#img1:hover ~ #img2 {
    opacity: 0;
}

在visual studio中,我得到“意想不到的字符序列”的错误,当我使用这个符号。这在CSS中的实际意义是什么。它有什么作用?

解决方法

http://www.w3.org/TR/selectors/

8.3.2. General sibling combinator

The general sibling combinator is made of the “tilde” (U+007E,~)
character that separates two sequences of simple selectors. The
elements represented by the two sequences share the same parent in the
document tree and the element represented by the first sequence
precedes (not necessarily immediately) the element represented by the
second one.

h1 ~ pre

匹配< pre>这里:

<h1>Definition of the function a</h1>
<p>Function a(x) has to be applied to all figures in the table.</p>
<pre>function a(x) = 12x/13.5</pre>

还存在用于相邻兄弟组合器的选择器:具有h1 pre< pre>标签必须在< h1>

猜你在找的CSS相关文章