(〜)是什么意思在CSS [英] What does (~) mean in CSS

查看:171
本文介绍了(〜)是什么意思在CSS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道(〜)在css中是什么意思。

 #img1:hover〜#img2 {
opacity:0;
}

在visual studio中,我得到'意想不到的字符序列'符号。这在CSS中的实际意义是什么。它是做什么的?

解决方案

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


8.3.2。通用同级组合器



一般的同级组合器由tilde(U + 007E,〜)
字符组成,简单选择器。由两个序列表示的
元素在
文档树中共享相同的父元素,并且由第一序列表示的元素
在由
表示的元素之前(不一定立即)第二个。


示例

  h1〜pre 

符合<

< p>函数a(x)必须应用于表中的所有图形。< / p>
< pre> function a(x)= 12x / 13.5< / pre>

还有 + sibling组合器: h1 + pre < pre> 标签必须在< h1>


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?

解决方案

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.

example

h1 ~ pre

matches that <pre> here:

<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>

There is also + selector, for adjacent sibling combinator: with h1 + pre the <pre> tag would have to be right after <h1>

这篇关于(〜)是什么意思在CSS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆