CSS element Selector

Definition and usage

CSS element Selectors are used to select all elements with the specified element name.

When using @namespace At this time, the selector can be namespace-limited.

  • ns|p - Select <p> elements in the namespace ns
  • *|p - Select all <p> elements
  • |p - Select all <p> elements that have not declared any namespace

Example

Select and set the style for all <h1> elements, and at the same time select and set the style for all <p> elements:

h1 {
  border: 2px solid green;
  background-color: beige;
}
p {
  background-color: yellow;
}

Try it yourself

CSS syntax

element {
  css declarations;
}

CSS syntax with namespace

namespace|element {
  css declarations;
}

Technical details

Version: CSS1

Browser support

Chrome Edge Firefox Safari Opera
Ondersteuning Ondersteuning Ondersteuning Ondersteuning Ondersteuning