CSS element selectors

definition and usage

CSS element selectors are used to select all elements with specified element names.

in use @namespace at this time, this selector can be namespace qualified.

  • 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 of all <h1> elements, and select and set the style of all <p> elements at the same time:

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

try it yourself

CSS syntax

element {
  css declarations;
}

namespace CSS syntax

namespace|element {
  css declarations;
}

technical details

version: CSS1

browser supports

Chrome Edge Firefox Safari Opera
دعم دعم دعم دعم دعم