CSS element Selector
Example
Select and style all <h1> elements, and also select and style all <p> elements:
h1 {
border: 2px solid green;
background-color: beige;
}
p {
background-color: yellow;
}
Try it Yourself »
Definition and Usage
The element
selector selects all elements with the specified element name.
This selector can be namespaced when using @namespace.
- ns|p - selects <p> elements in namespace ns
- *|p - selects all <p> elements
- |p - selects all <p> elements without any namespace declared
Version: | CSS1 |
---|
Browser Support
Selector | |||||
---|---|---|---|---|---|
element | Yes | Yes | Yes | Yes | Yes |
CSS Syntax
CSS Syntax with Namespace
namespace|element {
css declarations;
}