CSS Universal Selector
Universal Selector :
We have seen “ID Selector” and “Class Selector” in our previous chapters now we are going to see the “Universal Selector”.
- The universal selector is an represented by asterisk.
- When used , the universal selector tells the CSS interpreter to apply the CSS rule to all elements in the document.
- *Precaution : Do not use Universal Selector unless it is mandatory.
Example : Universal Selector
* { font-family: Arial, Helvetica,sans-serif; }
Complete Example : Universal Selector
<html> <head> <style type="text/css"> * { font-family: Arial, Helvetica, sans-serif; } </style> </head> <body> <h1>This is H1 Type Heading !!</h1> <h2>This is H2 Type Heading !!</h2> <h3>This is H3 Type Heading !!</h3> </body> </html>
Explanation :
- Universal rule is applied to each and every elements contained in the document.
- Universal selector rule is also applies to form input fields and tables of data.
- All elements would have following property applied -
font-family: Arial, Helvetica, sans-serif