Join MDN and developers like you at Mozilla's View Source conference, 12-14 September in Berlin, Germany. Learn more at https://viewsourceconf.org

Type selectors Redirect 1

Summary

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>

Result

Specifications

Specification Status Comment
CSS Selectors Level 3 Recommendation No change
CSS 2.1 Recommendation  
CSS 1 Recommendation  

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support (Yes) (Yes) (Yes) (Yes) (Yes)
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support ? ? ? ? ? ?

See also

Document Tags and Contributors

 Last updated by: Sheppy,