+ 2

Can div get more than 1 id?

24th Feb 2019, 2:36 PM
nuclearcode
nuclearcode - avatar
4 odpowiedzi
+ 1
A div can only have 1 id but can have multiple classes.
24th Feb 2019, 2:42 PM
Mike
Mike - avatar
+ 3
"id"s are meant to be for the unique part of a page . And you can only use an Id once on a page
24th Feb 2019, 2:40 PM
John Asaolu
John Asaolu - avatar
+ 2
If you want to style the div container more than once, it's better to use the class attribute because id attribute can only be used once with an element and it must be unique. With class attribute you can apply two different style like this: <div class=“one two”>...</div>
26th Feb 2019, 6:42 AM
Precious
Precious - avatar
0
Ok thx!
24th Feb 2019, 2:45 PM
nuclearcode
nuclearcode - avatar