What is the usage of Class selector and differentiate Class selector from ID Selector ? 

Question :

What is the usage of Class selector and differentiate Class selector from ID Selector ? 

The class selector selects elements with a specific class attribute. To select elements With a specific class, write a period (.) character, followed by the name of the class. With ID Selector, we can select an element by pointing out the unique ID name set with the id attribute. It we use that selector can be used only once in html document. It we use that selector on More than one element, our code will not pass validation. The difference between the Class and ID selector is: The ID selector consists of a hash (#) followed by the unique ID name of a referring HTML Element. ID selector cannot start with a number and must be at least one character long. They Also case-sensitive, and must exactly match across HTML,CSS and JavaScript.

The ID selector in CSS document:

 Text-align: center;
 Color: blue; } 

Class selector

When we want to style name more than one object on a web page, we should be using a class selector. To use multiple elements in an HTML document can have the same class value. In addition, a single element can have multiple class name separate by white space. A Class selector can have any name that starts with a letter, hyphen or underscore

A class selector in HTML document: 

.center { 
Text-align: center; 
Color: blue; 

In CSS a class selector starts with a dot (.), like this: 
.bank { /* this is the class selector */ 
Text-color: red; 
The only difference between them is the “id” is unique in a page can only apply at one element, While “class” selector can apply to multiple elements. 

CCC Online Test 2021 CCC Practice Test Hindi Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level NIELIT Study material and Quiz Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Website development Company in Allahabad