Type Selectors - CSS - Cascading Style Sheets - MDN
Type Selectors - CSS - Cascading Style Sheets - MDN
The CSS type selector matches elements by node name. In other words, it selects all elements of the given type within a document.
/* All <a> elements. */
a {
color: red;
Type selectors can be namespaced when using @namespace . This is useful when dealing with documents containing multiple namespaces such
as HTML with inline SVG or MathML, or XML that mixes multiple vocabularies.
ns|h1 - matches <h1> elements in namespace ns
*|h1 - matches all <h1> elements
Syntax
element { style properties }
Examples
CSS
span {
background-color: skyblue;
HTML
<span>Here's a span with some text.</span>
Result
Here's a span with some text.
Namespaces
In this example the selector will only match <h1> elements in the example namespace.
@namespace example url(http://www.example.com);
example|h1 {
color: blue;
Specifications
Specification
Selectors Level 4
# type-selectors
Browser compatibility
Report problems with this compatibility data on GitHub
diordnA arepO
emorhC
xoferiF
arepO
irafaS
egdE
Type selector Chrome 1 Edge 12 Firefox 1 Opera 3.5 Safari 1 Chrome 18 Firefox 4 Opera 10.1
( elementName ) Android for Android
Android
Namespaces Chrome 1 Edge 12 Firefox 1 Opera 8 Safari 1.3 Chrome 18 Firefox 4 Opera 10.1
( ns|elementName ) Android for Android
Android
Tip: you can click/tap on a cell for more information.
Full support
See also
CSS Selectors
Learn CSS: Selectors