What is the point in div elements?

What is the point in div elements?
0

#1

I want to understand what the point is in div elements.
Can you explain me?


#2

Allows someone writing HTML to divide up or collect bits of the HTML into generic containing elements. So they’re used everywhere, constantly when writing HTML.

There is a collection of named tags, but they only cover a small set of uses, there are infinite other uses that you can think of. Like there are <header> tags, so you could put your <h1> <h2> etc tags. But there isn’t a <subheader> tag. There’s no <carousel> tag or <timeline> or <footer-meta-information>, or whatever you can possibly think of.


#3

Just to add a bit to the above comment, the reason you would want to divide up or collect bits of the html is so you can then target those elements with either your CSS, JavaScript, or elsewhere.

So say you have a login form somewhere on your home page. You want to move the login form to the top right of the page. Instead of moving each element individually, you can wrap the entire thing into a
<div id="login-form"> and then target the div in your CSS and move it. Everything inside will go with it.

Hope that helps!


#4

Thank you guys,now i got it