why should we use div tag | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 1

why should we use div tag

10th Nov 2016, 7:10 AM
Balaji Narasimhan
Balaji Narasimhan - avatar
4 Réponses
+ 2
div id divider tag we can logically divides part of webpage using div . it is not necessary but we shots have to use.
10th Nov 2016, 7:14 AM
Harish Nandoliya
Harish Nandoliya - avatar
+ 2
You use it to divide blocks of content, kinda how you use the <p> tag to describe a paragraph of content. In reality all a <p> does is add a break at the end of the tag you can do the same with <br> but by using <div> or <p> when someone else looks at your code it will become easier for them determine the structure of your content thus being easier to read and understand.
10th Nov 2016, 7:18 AM
J.C Vega
J.C Vega - avatar
+ 1
DIV tag may seem useless in the beginning -I've been asking your question too- But as you go further you will find it so useful for generally two reasons: 1- Obviously to keep your work neat and clear and to be able to find parts of your website easily. 2- When you get to the styling you may find your self in need to make bunch of elements have the same style and so you'll put them all inside a DIV tag and just write the styling code once. Hope I helped ^_^
10th Nov 2016, 6:19 PM
Ahmed Abdelwadod
Ahmed Abdelwadod - avatar
+ 1
div tag is for division of your articles. it acts as a container where you can put almost any other HTML tags used inside the body tag. People use it with CSS and give different id like <div id="top"> <div id="rightbox"> <div id="main content"> <div id="bottom"> u can give different border, text color and independently format the content of each paragraph with CSS like the CSS code below CSS //general text color inside paragraph p {color:aqua;} //overwrites the aqua color with green #top p {color:green;} //overwrites aqua with red #bottom p{ color: red;} This independent ability makes it efficient in styling.
16th Nov 2016, 10:57 AM
Core i9
Core i9 - avatar