Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialKrishnendu Banerjee
1,005 PointsWhat is a div
what does div mean and what does <div> </div> contain in between then.
2 Answers
lihaoquan
12,045 Points- Div is a HTML element used to group HTML elements together. It acts as a container for other html elements. Example :
<!-- This section is the header section of the page. -->
<div id="header">
// Some html elements here.
</div>
<!-- This section is the navigational section of the page. -->
<div id="navigation">
// Some html elements here.
</div>
- Contain between them means the HTML elements are in between the opening div tag, and the closing div tag. Example :
<div><!-- Opening div tag -->
<p>This paragraph is contained in between the div</p>
</div><!-- Closing div tag -->
Artyom Karapetov
406 PointsAdding to the other answers, div is used for applying the same CSS styling to multiple elements at once. So instead of writing the same CSS for every element (for e.g. each element in the header), instead we wrap around the header with a unique div element and use it as a selector.
Andreas Anastasiades
2,916 PointsAndreas Anastasiades
2,916 Pointsif you're still interested in knowing what it means, it's just "Document division" :)