how to use div?why we use div? please give examples. it necessary to write everything in div. I need a professional opinion. please answer my question? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

how to use div?why we use div? please give examples. it necessary to write everything in div. I need a professional opinion. please answer my question?

I know what is inline and block element. but I always get confused when we use div tag?

29th Jun 2016, 9:29 PM
Harsh Realm
Harsh Realm - avatar
4 Answers
+ 1
div tag is used to create section in webpage like if you want to create footer section put all the elements required in header into that div element same for footer and other sections. inshort it is used to divide webpage into different sections.
30th Jun 2016, 6:37 AM
Shubham Kothekar
Shubham Kothekar - avatar
+ 1
Div has no semantic meaning, Therefor HTML5 has introduced many new tags that describe content better for us to use instead of divs like <nav>, <section>, <header>, <article>, <footer>, etc..
1st Jul 2016, 1:06 AM
ZinC
ZinC - avatar
29th Jun 2016, 10:05 PM
sagir
sagir - avatar
- 1
e.g. we use div (it means division) for creating menus of the website. So we create a div for something like left menus and it will have some nested divs for each menu. and also we can do this for header, footer, posts, and etc.
30th Jun 2016, 4:41 PM
DanI MicraS
DanI MicraS - avatar