List different selectors available in CSS and explain in detail

List different selectors available in CSS and explain in detail


Answer:


Different types of CSS selector are

  1. Universal Selector
  2. Element Type Selector
  3. Class Selector
  4. Id Selector

Universal Selector

It selects all the elements in the Html file.

Example
*{
color:red;
font-size:20px;
}

Element Type selector

It will select respective element like img,a,ul,li,th etc

Example
ul{
color:red;
}
p{
font-size:20px;
}

Id Selector

It will select based on id.we have to add #(hash) at the beginning of id to use id selector.

Example

#id1{
color:green;
}
#abc{
color:red;
}

Class Selector

It will Select Based on class.we have to add . (dot) at the beginning of class to use a class selector.

Example
.class1{
color:blue;
}
.xyz{
color:red;
}

Other Question With Answer


















5 comments:

  1. I like this site very much, Its a really nice situation to read and get info . ny web design firms

    ReplyDelete
  2. Your home is valueble for me. Thanks!? This web page is really a walk-via for all of the information you needed about this and didn know who to ask. Glimpse right here, and you l definitely uncover it. web design agency new york

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. Chaga mushroom coffee been recently brought to plenty of everything about simply because of the Ukrainian article author Alexandr Solzhenitsyn by it’s new ‘Cancer Ward’ in which traditional qualities is generally cured of a tumors on the help consume. Siberian Chaga ux agency san francisco

    ReplyDelete

For Query and doubts!

Powered by Blogger.