Different Types of Selector in the CSS
CSS Selectors, as the name implies, select an element corresponding to it in the coding of your HTML web page. There are a number of selectors depending upon their scope throughout the web page. Availability of a number of selectors in the CSS makes it different, more reliable, and one of the most powerful languages over the Internet. You must choose any selector according its scope throughout your web page i.e., how much you want to use it in your web page. So, below are a list of selectors used while designing CSS for a web page.
Universal Selector
Universal Selector is represented by an asterisk (*) sign also called a wildcard. With this selector we can any or all elements in the document. It is defined as
* { color : red; }
The above example will apply red color to all the foreground text to all the elements. It includes headings, paragraph, div element, cells in tables, etc..
Element Selector
An element selector selects every element in the document that matches the tag designed with that selector. Element selector is more specific than that of the Universal Selector. For example,
ex { color: red; }
In this, every ex tag in the document will be given red foreground color. These are also called as type selectors too. If there are a number of elements corresponding to this tag then it will be modified according to the attribute properties specified under this selection.