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
Russ Fleharty
Python Web Development Techdegree Student 10,815 PointsWhy divs?
I've noticed that most web-sites are pretty much made up of div elements. As I'm learning to become a front end web-developer myself, I am wondering if that's a good habit to follow or is it just a preference?
Thanks in advance. Russ
2 Answers
luke hammer
25,513 PointsDIVs are one of the primary ways to break up HTML code. I see where the beginning perspective you would think that this is a lot of wasted time and energy. I see that you are pretty deep with your treehouse training in CSS and JavaScript. So you alreadyw know that multiple divs allows you to manipulate that data better in the future. Although it’s not impossible easier to target an entire DIV then simply part of the contents within a div. As for habits I would suggest this anytime you might need a different behavior from one section of your website to another it should be within its own div. Also in most cases it’s easier to give the same class name multiple DIVs then to attempt to break out a smaller portion within a div.
Domnick Knowlton
Courses Plus Student 2,437 PointsThis is technically a preference. Although, any good developer will realize that the Div's will help with nearly everything. From diving elements to even diving content. To me I will never ever go out without using these. These are a necessity to me. You should definitely learn to use these efficiently.
Domnick Knowlton
Courses Plus Student 2,437 PointsDomnick Knowlton
Courses Plus Student 2,437 PointsI did vote it up, until I had read the last of the where you were asking for it.
Please don't ask for votes.
luke hammer
25,513 Pointsluke hammer
25,513 Pointsif i remove the comment will you return your vote?