What is a universal selector in CSS ?

In This blog, we are going to learn, what is universal selector in CSS.

What is a CSS universal selector?

CSS universal selectors select any type of elements in an HTML page. the asterisk (*) is known as the CSS universal selectors. This selector is useful when we want to select all the elements on the page.

For example:

CSS:
/* Selects all elements */

* {
  color: green;
}

all the element’s color changes to red.

The (*) is optional with simple selectors. For instance, *.name and .name are equivalent.

For example:

*.name {
  color: red;
}

* [lang^=en] {
  color: green;
}

All the elements with class= “name” will be turned to the color red, and All the elements with the attribute [lang^=en] will be turned to the color green.

With the help of universal selector, we can reduce the line of css.

Thanks for following this Blog.

s expoundsofttechsolution