0
But why They use id and class?
4 Answers
+ 2
We can assign more than one element with same class but we can assign only one element with same I'd name. We can style more than one element like div, p, he, footer etc combinely with giving them same class
0
It's so that we could assign styles to different elements under the same tag name. For eg.
<p id="one">one</p>
<p class="two">two</p>
Here both have same tag i.e <p> but both can have different styles using the id and class name
0
ok
0
for example if I'd like the first letter of the first paragraph of a page to be larger I would use an id and if I want every other paragraph to have a light grey background I'd use a class.