Селектор по типу

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

We’d love to hear your thoughts on the next set of proposals for the JavaScript language. You can find a description of the proposals here.
Please take two minutes to fill out our short survey.

Краткое описание

CSS селекторы по типу выбирают элементы по имени узла. Используются отдельно, поэтому, селектор типа для конкретного имени тега выбирает все элементы этого типа, то есть с этим именем узла в документе.

Синтаксис

element { style properties }

Пример

CSS

css
span {
  background-color: DodgerBlue;
  color: #ffffff;
}

HTML

html
<span>Здесь тег span с каким-то текстом.</span>
<p>Здесь тег p с каким-то текстом.</p>

Результат

Спецификации

Specification
Selectors Level 4
# type-selectors

Совместимость с браузерами