Type selectors

Type selectors

CSS type selectors match elements by node name. Used alone, therefore, a type selector for a particular node name selects all elements of that type — that is, with that node name — in the document.

Syntax

element { style properties }

Example

CSS

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

HTML

<span>Here's a span with some text.</span>
<p>Here's a p with some text.</p>
<span>Here's a span with more text.</span>

Result

登录查看完整内容