CSS Universal Selector (*)
- Previous Page #id
- Next Page .class
- Go to the Previous Level CSS Selector Reference Manual
Definition and usage
CSS Universal Selector (*
) is used to select all types of elements.
Universal selector (*
) you can also choose all elements within another element (see the following examples).
When using @namespace
At this time, the selector can also be namespace qualified.
- ns|* - Select all elements within the namespace ns
- *|* - Select all elements
- |* - Select all elements that have not declared any namespace
Examples
Example 1
Select and set the style for all elements:
* { border: 2px solid green; background-color: beige; }
Example 2
Select and set the style for all elements inside the <div> element:
div * { background-color: yellow; }
CSS syntax
* { css declarations; }
CSS syntax with namespace
namespace|* { css declarations; }
Technical details
Version: | CSS2 |
---|
Browser support
The numbers in the table indicate the first browser version that fully supports the selector.
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Support | Support | Support | Support | Support |
- Previous Page #id
- Next Page .class
- Go to the Previous Level CSS Selector Reference Manual