CSS - Universal Selectors
CSS - Universal Selectors
Universal Selectors in CSS
CSS universal selector is a special selector that selects all the elements in an HTML document. It is denoted by anasterisk mark (*). Universal selector is used to set a similar style for the entire document.
Syntax
The syntax for the CSS universal selector is as follows:
CSS CODE
* {
margin: 0;
padding: 0;
}Using Universal Selector Setting Background Color
To set thebackground colorand textcolorof the web page, universal selector is used:
Example
Let us see an example to set the background color and text color of the HTML document.
Preview
Using Universal Selector Setting Border
We have used the Universal Selector to set theborderof the HTML document.
Example
Here is an example of setting the border of an HTML web page.
Preview
Using Universal Selector Setting Font
Use the universal selector to set a similar font for all the elements in the web page.
Example
Here is an example to set thefontandfont sizeof the document.
Preview