diff options
Diffstat (limited to 'files/fa/web/css/attribute_selectors/index.html')
-rw-r--r-- | files/fa/web/css/attribute_selectors/index.html | 183 |
1 files changed, 0 insertions, 183 deletions
diff --git a/files/fa/web/css/attribute_selectors/index.html b/files/fa/web/css/attribute_selectors/index.html deleted file mode 100644 index b5ead5055f..0000000000 --- a/files/fa/web/css/attribute_selectors/index.html +++ /dev/null @@ -1,183 +0,0 @@ ---- -title: انتخابگر ویژگی -slug: Web/CSS/Attribute_selectors -translation_of: Web/CSS/Attribute_selectors -original_slug: Web/CSS/انتخابگرـویژگی ---- -<div>{{CSSRef}}</div> - -<p dir="rtl"><strong>انتخابگر ویژگی</strong> بر اساس وجود ویژگی یا مقدار ویژگی انتخاب میکند.</p> - -<pre class="brush: css no-line-numbers">/* را داشته باشند title که ویژگی <a> عنصرهای */ -a[title] { - color: purple; -} - -/* باشد "https://example.org" آن برابر با href که ویژگی <a> عنصرهای */ -a[href="https://example.org"] { - color: green; -} - -/* باشد "example" آن در بردارندهی href که ویژگی <a> عنصرهای */ -a[href*="example"] { - font-size: 2em; -} - -/* به پایان رسیده باشد ".org" آن با href که ویژگی <a> عنصرهای */ -a[href$=".org"] { - font-style: italic; -}</pre> - -<dl> - <dt><code>[<em>attr</em>]</code></dt> - <dd>Represents elements with an attribute name of <em>attr</em>.</dd> - <dt><code>[<em>attr</em>=<em>value</em>]</code></dt> - <dd>Represents elements with an attribute name of <em>attr</em> whose value is exactly <em>value</em>.</dd> - <dt><code>[<em>attr</em>~=<em>value</em>]</code></dt> - <dd>Represents elements with an attribute name of <em>attr</em> whose value is a whitespace-separated list of words, one of which is exactly <em>value</em>.</dd> - <dt><code>[<em>attr</em>|=<em>value</em>]</code></dt> - <dd>Represents elements with an attribute name of <em>attr</em> whose value can be exactly <em>value</em> or can begin with <em>value</em> immediately followed by a hyphen, <code>-</code> (U+002D). It is often used for language subcode matches.</dd> - <dt><code>[<em>attr</em>^=<em>value</em>]</code></dt> - <dd>Represents elements with an attribute name of <em>attr</em> whose value is prefixed (preceded) by <em>value</em>.</dd> - <dt><code>[<em>attr</em>$=<em>value</em>]</code></dt> - <dd>Represents elements with an attribute name of <em>attr</em> whose value is suffixed (followed) by <em>value</em>.</dd> - <dt><code>[<em>attr</em>*=<em>value</em>]</code></dt> - <dd>Represents elements with an attribute name of <em>attr</em> whose value contains at least one occurrence of <em>value</em> within the string.</dd> - <dt id="case-insensitive"><code>[<em>attr</em> <em>operator</em> <em>value</em> i]</code></dt> - <dd>Adding an <code>i</code> (or <code>I</code>) before the closing bracket causes the value to be compared case-insensitively (for characters within the ASCII range).</dd> -</dl> - -<h2 id="Examples">Examples</h2> - -<h3 id="Links">Links</h3> - -<h4 id="CSS">CSS</h4> - -<pre class="brush: css">a { - color: blue; -} - -/* Internal links, beginning with "#" */ -a[href^="#"] { - background-color: gold; -} - -/* Links with "example" anywhere in the URL */ -a[href*="example"] { - background-color: silver; -} - -/* Links with "insensitive" anywhere in the URL, - regardless of capitalization */ -a[href*="insensitive" i] { - color: cyan; -} - -/* Links that end in ".org" */ -a[href$=".org"] { - color: red; -} -</pre> - -<h4 id="HTML">HTML</h4> - -<pre class="brush: html"><ul> - <li><a href="#internal">Internal link</a></li> - <li><a href="http://example.com">Example link</a></li> - <li><a href="#InSensitive">Insensitive internal link</a></li> - <li><a href="http://example.org">Example org link</a></li> -</ul></pre> - -<h4 id="Result">Result</h4> - -<p>{{EmbedLiveSample('Links')}}</p> - -<h3 id="Languages">Languages</h3> - -<h4 id="CSS_2">CSS</h4> - -<pre class="brush: css">/* All divs with a `lang` attribute are bold. */ -div[lang] { - font-weight: bold; -} - -/* All divs in US English are blue. */ -div[lang~="en-us"] { - color: blue; -} - -/* All divs in Portuguese are green. */ -div[lang="pt"] { - color: green; -} - -/* All divs in Chinese are red, whether - simplified (zh-CN) or traditional (zh-TW). */ -div[lang|="zh"] { - color: red; -} - -/* All divs with a Traditional Chinese - `data-lang` are purple. */ -/* Note: You could also use hyphenated attributes - without double quotes */ -div[data-lang="zh-TW"] { - color: purple; -} -</pre> - -<h4 id="HTML_2">HTML</h4> - -<pre class="brush: html"><div lang="en-us en-gb en-au en-nz">Hello World!</div> -<div lang="pt">Olá Mundo!</div> -<div lang="zh-CN">世界您好!</div> -<div lang="zh-TW">世界您好!</div> -<div data-lang="zh-TW">?世界您好!</div> -</pre> - -<h4 id="Result_2">Result</h4> - -<p>{{EmbedLiveSample('Languages')}}</p> - -<h2 id="Specifications">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>{{SpecName('CSS4 Selectors', '#attribute-selectors', 'attribute selectors')}}</td> - <td>{{Spec2('CSS4 Selectors')}}</td> - <td>Adds modifier for ASCII case-insensitive attribute value selection</td> - </tr> - <tr> - <td>{{SpecName('CSS3 Selectors', '#attribute-selectors', 'attribute selectors')}}</td> - <td>{{Spec2('CSS3 Selectors')}}</td> - <td> </td> - </tr> - <tr> - <td>{{SpecName('CSS2.1', 'selector.html#attribute-selectors', 'attribute selectors')}}</td> - <td>{{Spec2('CSS2.1')}}</td> - <td>Initial definition</td> - </tr> - </tbody> -</table> - -<h2 id="Browser_compatibility">Browser compatibility</h2> - - - -<p>{{Compat("css.selectors.attribute")}}</p> - -<h2 id="See_also">See also</h2> - -<ul> - <li>Selecting a single element: {{domxref("Document.querySelector()")}}, {{domxref("DocumentFragment.querySelector()")}}, or {{domxref("Element.querySelector()")}}</li> - <li>Selecting all matching elements: {{domxref("Document.querySelectorAll()")}}, {{domxref("DocumentFragment.querySelectorAll()")}}, or {{domxref("Element.querySelectorAll()")}}</li> - <li>The above methods are all implemented based on the {{domxref("ParentNode")}} mixin; see {{domxref("ParentNode.querySelector()")}} and {{domxref("ParentNode.querySelectorAll()")}}</li> -</ul> |