* { box-sizing: border-box; } physique {margin: 0;}*{box-sizing:border-box;}physique{margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;}#iwrr{background-color:rgb(243, 245, 246);}
The div
component has no particular which means, but it surely’s used loads! Briefly, it represents its kids. It’s used to group parts on a web page for styling contexts.
It’s a simple selection, however it’s best to actually use the <div>
component as final resort for the sake of accessibility. For instance, as a substitute of utilizing a <div>
component to group the content material from an extended type article you possibly can attain for the <article>
component as a substitute.
Instance
Syntax
1 |
<div class="container"> |
2 |
<article>
|
3 |
<p>Ipsum labore velit anim nulla aliqua ea in mollit et eiusmod minim aute do. Cillum elit do veniam deserunt aliqua enim consequat nisi laboris fugiat sint. Advert enim enim non.</p> |
4 |
</article>
|
5 |
<article>
|
6 |
<p>Ipsum labore velit anim nulla aliqua ea in mollit et eiusmod minim aute do. Cillum elit do veniam deserunt aliqua enim consequat nisi laboris fugiat sint. Advert enim enim non.</p> |
7 |
</article>
|
8 |
</div>
|
Consequence
Browser Help
The <div>
tag is supported in all fashionable browsers. Learn extra on caniuse.com.
Attributes
The <div>
tag helps International Attributes in HTML. International Attributes are frequent to all HTML parts and can be utilized on all of them (although they could not have a lot of an impact on a few of them).
Content material
If the <div>
component will not be a baby of a <dl>
component the kind of content material mannequin is flow content material. If it’s a youngster of the <dl>
component it’s used for wrapping teams of dt
and dd
parts.
Associated HTML Components
- The
<div>
component is much like the<span>
component, in that they’re each generic and don’t describe their content material. Nevertheless,<span>
is an inline component.