What is <div> tag in html | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

What is <div> tag in html

I can't understand the use of div tag and I can see its use in almost all websites so if any one can help me !

11th May 2017, 5:53 PM
Vaibhav Singh Sikarwar
Vaibhav Singh Sikarwar - avatar
5 Answers
+ 5
In simpler words it's a rectangle box which by default invisible , when you add CSS background-color and other properties it becomes visible . In this box you can keep other things like a set of books (in here paragraphs , images , lists ,tables ,etc.) The advantage of using div is that if we want to move or assemble books it would be easier to move them together if they are in a container (box) other than moving or organising one by one . So when we move or place a div using CSS every book ( objects )in it moves along with it , so if we know which things are meant to be together , it becomes much easier to organize them .
12th May 2017, 5:20 AM
Utkαrsh
Utkαrsh - avatar
+ 4
It is a division, or section, like Claudio said. Most of the times it acts as a sort of "container" to other tags or blocks. So that you have a reference (mostly by adding an "id" to the div) to use for all the content inside it.
11th May 2017, 6:07 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 4
Additionally we can draw through them , ( not suggested ) but I usually do , each of these codes are using mainly div's- https://code.sololearn.com/Wo8H7sTdK77j/?ref=app https://code.sololearn.com/WIE1o6Cv7y8k/?ref=app https://code.sololearn.com/Wp4p959M9CbC/?ref=app
12th May 2017, 5:23 AM
Utkαrsh
Utkαrsh - avatar
+ 3
<div> is a section every area in a web can be a div and in most cases it should be a div to keep the HTML code clean and maintaneable
11th May 2017, 6:03 PM
⏩▶Clau◀⏪
⏩▶Clau◀⏪ - avatar
+ 3
<div> is a generic container for all things not related to other existing semantically more specific tags...
12th May 2017, 4:35 AM
visph
visph - avatar