Div
Category:HTML Tags
Div
The div tag <div>
divides the HTML document into sections of content. This div tag <div>
is used to group together HTML elements, allowing you to apply CSS styles to many elements at once.
Examples
Using <div>
to group (<h4>
, <p>
, <ul>
) to be styled as red.
<div style = "color:red">
<h4>This is first group</h4>
<p>Following is a list of vegetables</p>
<ul>
<li>Beetroot</li>
<li>Ginger</li>
</ul>
</div>
Syntax
<div></div>
Tips
- Use
<div>
to set a section in an HTML document and groups elements for formatting with class or id attributes. - Any sort of content can be put inside the
<div>
tags, such as text, list, images, etc.
Additional Information
For more information, see http://www.w3schools.com/tags/tag_div.asp.
Found a bug in the documentation? Let us know at support@code.org.