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

What is <div>?

div </div> <div and blah blah! > what are its uses, when it is use? help me understanding this stuff

18th May 2018, 12:10 PM
Huzaifa Ghulamhussain
Huzaifa Ghulamhussain - avatar
7 Answers
+ 15
<div> is only a container for HTML elements. Suppose you want to apply two different type of CSS font in your code, then you can put them in <div> container. Hence, <div>, as it stands division, is mainly use to divide HTML elements for styling and coding purposes. <div class = "a" id = "b"> This stuff is used when you are using a lot of div containers. It can help in seperating different div tags. Div tags can have same class but id should be unique. Thus id helps in identifying each div uniquely and class is used for applying some common style to some divs.
18th May 2018, 12:23 PM
Arushi Singhania
Arushi Singhania - avatar
+ 14
Sanjeet Patel The only difference between both is that div is a block level element while span is an inline element.
18th May 2018, 12:28 PM
Arushi Singhania
Arushi Singhania - avatar
+ 5
ArtemisAthena456 Thank you for that,☺
18th May 2018, 1:01 PM
Sanjeet
Sanjeet - avatar
+ 5
ArtemisAthena456 Ok, thanks😊
18th May 2018, 1:06 PM
Sanjeet
Sanjeet - avatar
+ 4
ArtemisAthena456 Please can you tell me that how <span> is different from <div>,😃
18th May 2018, 12:24 PM
Sanjeet
Sanjeet - avatar
+ 2
The <div> tag defines a division or a section in an HTML document. 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.
18th May 2018, 12:17 PM
Rajeeb
+ 1
that is a div tag uses for make parts in your web page
18th May 2018, 12:44 PM
Khushal Patel
Khushal Patel - avatar