Div tags id's and class attributes. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Div tags id's and class attributes.

Hello, please Why must we use the div tags and id's and class attributes when writing code even though they make the code look complex... Please why is it important? Thanks in advance.

19th Dec 2019, 9:31 AM
Oluwatobi
Oluwatobi - avatar
3 Answers
+ 7
When you want to style or embed some js code to a specific div section in your html document, the id or class attribs must be there, they are not there to make the code complex, they just serve as unique identifiers to each div section in your document Styling a div section with id attrib: # is used class attrib: . is used Embeding js code to a div with: id attrib: getElementById() method is used class atrrib: getElementByClass() is used Happy coding😉 Keep coding 🙏🏾
19th Dec 2019, 10:17 AM
Alfred Juma
Alfred Juma - avatar
+ 3
try searching here, in the questions and answers, using the search for the phrase "div". because the language barrier prevents me from answering your question. English speaking users have already responded many times
19th Dec 2019, 10:11 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
Thanks a lot. I appreciate
20th Dec 2019, 1:39 AM
Oluwatobi
Oluwatobi - avatar