Difference Between class and id in HTML

Was this a question or a small tut as the above example you have is wrong anyhow considering it’s an id selector NOT a class selector.

Always remember in your mind that dot is use for class and # use for id.

And class can be used multiple times and id s only in one element.
One can also have multiple classes by aeperatong the two with space. But only one id per one object and that id can only be used once. For example, <div class=“red square” id=redSquare"></div><div class=red square bigger" id=“redSquare2”></div>

You’re missing some quote marks in there:

<div class="red square" id="redSquare"></div><div class="red square bigger" id="redSquare2"></div>

Oh whoops. Sorry Thank ks for catching that :slight_smile:
I was jist leaving work and on sitepoint on my phone