--- title: Селекторы по ID slug: Web/CSS/ID_selectors translation_of: Web/CSS/ID_selectors ---
В HTML-документах CSS-селекторы по ID производят выборку всех элементов по ID, полностью совпадающих с селектором.
#id_value { style properties }
То же самое — {{ Cssxref("Attribute_selectors", "селектор по атрибутам") }}:
[id=id_value] { style properties }
span#identified {
background-color: DodgerBlue;
}
<span id="identified">Тут span с каким-то текстом.</span> <span>Здесь тоже span.</span>
{{ EmbedLiveSample('Example', 200, 50) }}
| Спецификация | Статус | Комментарий |
|---|---|---|
| {{ SpecName('CSS4 Selectors', '#id-selectors', 'ID selectors') }} | {{ Spec2('CSS4 Selectors') }} | |
| {{ SpecName('CSS3 Selectors', '#id-selectors', 'ID selectors') }} | {{ Spec2('CSS3 Selectors') }} | |
| {{ SpecName('CSS2.1', 'selector.html#id-selectors', 'ID selectors') }} | {{ Spec2('CSS2.1') }} | |
| {{ SpecName('CSS1', '#id-as-selector', 'ID selectors') }} | {{ Spec2('CSS1') }} | Изначальное определение |
{{ CompatibilityTable() }}
| Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|
| Basic support | {{ CompatVersionUnknown() }} | {{ CompatVersionUnknown() }} | {{ CompatVersionUnknown() }} | {{ CompatVersionUnknown() }} | {{ CompatVersionUnknown() }} |
| Feature | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
|---|---|---|---|---|---|---|
| Basic support | {{ CompatUnknown() }} | {{ CompatUnknown() }} | {{ CompatUnknown() }} | {{ CompatUnknown() }} | {{ CompatUnknown() }} | {{ CompatUnknown() }} |