微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

(〜)是什么意思在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>

原文地址:https://www.jb51.cc/css/220916.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。