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 trial

HTML

Quick question about div tag

I think I get what div is mainly used for and would like to understand it more clearly. It is use in conjunction with css to set things like your font size or color. If say your images or entire body is nested in a div tag and you go to CSS and set the margin or pixel size for div. The website will display according to what you set. Practically to separate elements and serves as a container or like what the video said a "wrapper?

2 Answers

The div is used for identifying and separating your website into sections. You identify them with classes(used for repetitive use) and ids(unique name that can only be used once in a web page)

Took me well several years to understand the concept. Think of divs is like a block on webpage. You can style that block.

you only need to know id and classes for css. Anyways goodluck.