Can anyone explain <div> tag for me | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

Can anyone explain <div> tag for me

17th Dec 2019, 4:01 PM
Mumtaz Ahmad
Mumtaz Ahmad - avatar
2 Answers
+ 1
The <div> element is often used as a container for other HTML elements to style them with CSS or to perform certain tasks with JavaScript. https://www.w3schools.com/TAGS/tag_div.asp
17th Dec 2019, 4:30 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
0
A <div> tag, also known as division is a tag that groups one, two or more html tag(s) together. 1) It allows you to identify a tag(e.g, <div id="body"> will identify the body tag and you can make reference to it from anywhere in your code. You can style it In your css, link to it or make use of it in javascript.) You can't identify two tags with the same id. 2) it allows you classify one, two or more tags and elements. e.g, using "<div class="mystyle">" will apply whatever you set for .mystyle in your css to anything that follows until you close the tag (</div>) You just classified or grouped whatever is in between <div class="mystyle"> and </div> together.
17th Dec 2019, 9:13 PM
Samagidi Victor - Vikksy
Samagidi Victor - Vikksy - avatar