CSS Selectors

CSS Selectors define the pattern to select to which a set of CSS rules the applied. We have different types of selectors in CSS let’s go through them one by one in detail and try to understand them,

  • Universal Selector

    With this selector, we can select the whole HTML body at once and apply any style
    universally, the style will apply to all the elements present inside that body. "*" is used to write universal selectors. The syntax for this selector is given below with an example,

```* { color: #b41a1a; }

    as we can see in the above code block in which we are applying a CSS property color 
    universally.


- Individual Selector

    So, in our previous selector, we can apply any CSS property universally, but with our   
    next selector, we can make the thing bit specific we can select each individual tag     
    like <p>, <span>, or any other that we want to style particularly. The syntax for this 
    selector is given below with an example,


```p {
        color: #d1ea76;
      }
 by the above code block, we can understand that <p> tag is being selected for 
 applying this property, what this block will do will select all the <p> tags present in that   
 HTML doc and apply the style to them, in our case it will change the color.
  • Class and Id Selector

    To use class and id selector we have to provide an attribute class and id respectively to the tag on which we want to apply the style, try to understand each by examples.

          .nav {
                      background-color: #ffffff 
                      font-size: 50 
                  }
          #btn{
                   color: #51E1ED
                  display: inline-block
                  }
      </style

      <div class="nav">Hi, coders</div>
      <button id="btn">Submit</button>

as written in the above code block inside the