aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/css/general_sibling_combinator
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/css/general_sibling_combinator
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/zh-cn/web/css/general_sibling_combinator')
-rw-r--r--files/zh-cn/web/css/general_sibling_combinator/index.html73
1 files changed, 73 insertions, 0 deletions
diff --git a/files/zh-cn/web/css/general_sibling_combinator/index.html b/files/zh-cn/web/css/general_sibling_combinator/index.html
new file mode 100644
index 0000000000..941e9c9218
--- /dev/null
+++ b/files/zh-cn/web/css/general_sibling_combinator/index.html
@@ -0,0 +1,73 @@
+---
+title: 通用兄弟选择器
+slug: Web/CSS/General_sibling_combinator
+tags:
+ - CSS
+ - Selectors
+translation_of: Web/CSS/General_sibling_combinator
+---
+<div>{{CSSRef}}</div>
+
+<h2 id="Summary" name="Summary">概述</h2>
+
+<p><font face="Lucida Grande, Lucida Sans Unicode, DejaVu Sans, Lucida, Arial, Helvetica, sans-serif">兄弟选择符,位置无须紧邻,只须同层级,</font><code>A~B</code> 选择<code>A</code>元素之后所有同层级<code>B</code>元素。</p>
+
+<h2 id="Syntax" name="Syntax">语法</h2>
+
+<pre class="syntaxbox notranslate">former_element ~ target_element { <em>style properties</em> }</pre>
+
+<h2 id="Examples" name="Examples">示例</h2>
+
+<pre class="brush: css">p ~ span {
+ color: red;
+}</pre>
+
+<p>上面的CSS作用于下面的HTML中:</p>
+
+<pre class="brush: html">&lt;span&gt;This is not red.&lt;/span&gt;
+&lt;p&gt;Here is a paragraph.&lt;/p&gt;
+&lt;code&gt;Here is some code.&lt;/code&gt;
+&lt;span&gt;And here is a span.&lt;/span&gt;</pre>
+
+<p>则会产生下面的效果:</p>
+
+<p>This is not red.</p>
+
+<p>Here is a paragraph.</p>
+
+<p><code>Here is some code.</code><span style="color: red;">And here is a span.</span></p>
+
+<h2 id="Specifications" name="Specifications">规范</h2>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td><a class="external" href="http://www.w3.org/TR/css3-selectors/#general-sibling-combinators" title="http://www.w3.org/TR/css3-selectors/#general-sibling-combinators">CSS Selectors Level 3</a></td>
+ <td>{{Spec2('CSS3 Selectors')}}</td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="浏览器兼容性">浏览器兼容性</h2>
+
+<p>{{Compat("css.selectors.general_sibling")}}</p>
+
+<div id="compat-mobile"></div>
+
+<h2 id="相关">相关</h2>
+
+<ul>
+ <li>{{Cssxref("Adjacent_sibling_selectors", "Adjacent sibling selectors")}}</li>
+</ul>
+
+<div id="blbt-translation-icon" style="margin: 0px; padding: 0px; font-family: sans-serif; position: fixed; left: 261px; top: 233px; width: 20px; height: 20px; line-height: 20px; color: rgb(255, 255, 255); background-color: rgb(0, 0, 0);">
+<div style="margin: 0px; padding: 0px; width: 20px; height: 20px; line-height: 20px; color: rgb(255, 255, 255); background-color: rgb(0, 0, 0);"></div>
+</div>