What is the asterisk selector (known as Universal Selector)

Chrome Devtool Selector

What is the asterisk selector (known as Universal Selector)

About

The universal selector 1) is the star character. (asterisk U+002A

It permits to select all type of tag element. The selection matchs any tag name.

Example

All descendant elements of the body that have a foo attribute

body *[foo]

Syntax

*

The following expressions are equivalent

Name Expression 1 Expression 2
Element selector
*[hreflang|=en]
[hreflang|=en]
Class selector
*.warning
.warning
id selector
*#myid
#myid





Discover More
Chrome Devtool Selector
How to select elements based on attribute ? (with the css selector API)

How to select elements based on attribute ? (with the selector API , css) API This page is selector expressions that select elements based on attribute. An ID selector and a class selector (ie...



Share this page:
Follow us:
Task Runner