Special welcome gift. Get 50% off your first courses with code “AS50”. Find out more!

HomeCoachingInterviewCSS Q/AWhat is the difference between class selector and ID selector?
course 13

What is the difference between class selector and ID selector?

Answer:

1. Class selector can be given to an overall block. This is sometimes termed as block element as well, whereas ID selector identifies a unique name and a style for a specific element.
2. ID selector declares the style for only one particular element which can be differentiated from other element, whereas Class selector is being given for the whole complete block.

Example of ID selector is being written like this:

#idname {color: red; background: black;}
This can be used in HTML as

<P ID= “idname”>this element only will be affected by the use of this ID element</P>

Share:

Leave A Reply

Your email address will not be published. Required fields are marked *

Categories

ads sidebar 1

You May Also Like

It’s about making websites work wherever the web is. Different devices with different sizes and different capabilities. Responsive design is...
It’s an alternative to graceful degradation, which concentrates on the matter of the web. The functionality is same, but it...