What’s the difference between div and class,ID? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What’s the difference between div and class,ID?

Hi Everyone- The div tag is used to divide up the page into sections, for organizational purposes and to help you style sections of the page differently. Class and ID are attributes that you can apply to different elements, including div elements, so you can select them with CSS to apply styles that you specify for that class or ID.

22nd Jul 2019, 3:06 PM
Adam Silver
Adam Silver - avatar
1 Answer
+ 1
Hi - The div tag is used to divide up the page into sections, for organizational purposes and to help you style sections of the page differently. Class and ID are attributes that you can apply to different elements, including div elements, so you can select them with CSS to apply styles that you specify for that class or ID.
22nd Jul 2019, 3:08 PM
Adam Silver
Adam Silver - avatar