CSS Selectors

CSS selectors are used to “attain” the HTML document component you want to style or makeover.

In CSS, there are five different types of selectors in CSS, which is given below.

  1. Element Selector
  2. Id Selector
  3. Class Selector
  4. Universal Selector
  5. Group Selector

The CSS Element Selector

In CSS element selector, we use the element name for the style to the HTML elements.


Example#1 In the given example all <p> text will be an increase in size and the text color will be black.

p {
font-size: 12px;
color: #000;

The CSS id Selector

In CSS id Selector, we use the id attribute for the style of an HTML element to select a specific element.

Pin It on Pinterest

Share This