Div and id | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Div and id

For what "div" is here? Is it nesessary for "id"?

11th Dec 2018, 11:28 PM
Masha Iularji
Masha Iularji - avatar
1 Answer
+ 1
The "div" tag is nothing more than a container unit that encapsulates other page elements and divides the HTML document into sections. The id attribute specifies a unique id for an HTML element (the value must be unique within the HTML document). The id attribute is most used to point to a style in a style sheet, and by JavaScript (via the HTML DOM) to manipulate the element with the specific id. and you don't need id in order to use div instead you can use class if you want to.
11th Dec 2018, 11:37 PM
Mad Clown
Mad Clown - avatar