What is Selector in JavaScript? Example.

Selectors are used to "find" (select) HTML elements based on their tag name, id, classes, types, attributes, values of attributes and much more. 

A list of all selectors can be found in our CSS Selector Reference.

Example 

Type Selector:-

p{
  color : red;
}

Class Selector:-

.head{
   color:green;
}

Id Selector:-

#Box{
   color: yellow;
}

Universal Selector:-

*{
   margin:0;
   padding:0;
}
Share:

No comments:

Post a Comment

Thursday, 4 July 2019

What is Selector in JavaScript? Example.

Selectors are used to "find" (select) HTML elements based on their tag name, id, classes, types, attributes, values of attributes and much more. 

A list of all selectors can be found in our CSS Selector Reference.

Example 

Type Selector:-

p{
  color : red;
}

Class Selector:-

.head{
   color:green;
}

Id Selector:-

#Box{
   color: yellow;
}

Universal Selector:-

*{
   margin:0;
   padding:0;
}

No comments:

Post a Comment

Popular

Total Pageviews

Archive