CSS - CSS Selector - CSS Universal Selector
Learn css - css tutorial - CSS Universal Selector - css examples - css programs
Universal Selector - Definition and Usage
- In css the Universal selector is used to select all the elements by applying many style.
- Selector is convenient when you want to set a style for of all the elements of an HTML page.
- Selector can also choose all elements inside another element.
- Asterisk (*) selector is used to select the begin and end of the string.
- In CSS, Instead of selecting elements of a specific type, the universal selector simply matches the name of any element type.
- To select elements with a specific attribute, write a asterisk (*) character.
css code - Example
- The above rule contribute that the content of every element in our document in orange color.
Sample coding - sample html code
Code Explanation - style css
- In case, if we want all the elements in the body to be appeared in same font & same color we can create a universal selector by just typing * asterisk.
- In CSS, Color property is used to assign color for the text font.Here, we have given color in hexadecimal code which indicates color orange(#FF8000).
- Font-family property in CSS used to specify a font style. Here, we have applied Arial style for the body elements.
css tutorial - Output :
- The paragraph text “Wikitechy In Orange” will appear in orange color with Arial font style which we had specified in CSS universal selector.
- The heading “Welcome to wikitechy” will also appear in orange color with Arial font style .