Div and id | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
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 Resposta
+ 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