aboutsummaryrefslogtreecommitdiff
path: root/files/ru/web/css/id_selectors/index.html
blob: 1341ccbea9192030bd62ca20208e227d2ae0a913 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
---
title: Селекторы по ID
slug: Web/CSS/ID_selectors
translation_of: Web/CSS/ID_selectors
---
<div>{{ CSSRef() }}</div>

<h2 id="Summary">Краткое описание</h2>

<p>В HTML-документах CSS-селекторы по ID производят выборку всех элементов по ID, полностью совпадающих с селектором.</p>

<h2 id="Syntax">Синтаксис</h2>

<pre class="syntaxbox">#id_value { <em>style properties</em> }</pre>

<p>То же самое  — {{ Cssxref("Attribute_selectors", "селектор по атрибутам") }}:</p>

<pre class="syntaxbox">[id=id_value] { <em>style properties</em> }</pre>

<h2 id="Example">Пример</h2>

<pre class="brush: css">span#identified {
  background-color: DodgerBlue;
}
</pre>

<pre class="brush: html">&lt;span id="identified"&gt;Тут span с каким-то текстом.&lt;/span&gt;
&lt;span&gt;Здесь тоже span.&lt;/span&gt;
</pre>

<p>{{ EmbedLiveSample('Example', 200, 50) }}</p>

<h2 id="Specifications">Спецификации</h2>

<table style="font-size: 14px; font-weight: normal; line-height: 1.5;">
 <thead>
  <tr>
   <th scope="col">Спецификация</th>
   <th scope="col">Статус</th>
   <th scope="col">Комментарий</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{ SpecName('CSS4 Selectors', '#id-selectors', 'ID selectors') }}</td>
   <td>{{ Spec2('CSS4 Selectors') }}</td>
   <td> </td>
  </tr>
  <tr>
   <td>{{ SpecName('CSS3 Selectors', '#id-selectors', 'ID selectors') }}</td>
   <td>{{ Spec2('CSS3 Selectors') }}</td>
   <td> </td>
  </tr>
  <tr>
   <td>{{ SpecName('CSS2.1', 'selector.html#id-selectors', 'ID selectors') }}</td>
   <td>{{ Spec2('CSS2.1') }}</td>
   <td> </td>
  </tr>
  <tr>
   <td>{{ SpecName('CSS1', '#id-as-selector', 'ID selectors') }}</td>
   <td>{{ Spec2('CSS1') }}</td>
   <td>Изначальное определение</td>
  </tr>
 </tbody>
</table>

<h2 id="Поддержка_браузерами">Поддержка браузерами</h2>

<p>{{Compat("css.selectors.id")}}</p>