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 Build a Simple Website Creating a Website Structure Working with Grids

why are we taking grids approach

hi everyone, I would like to know why are we taking grids approach? I mean usually i don't see grids used to comeup with a site. I have seen people using floats, position attribute etc .Could you please help me understand this

4 Answers

In graphic layouts grids are used to ensure clean horizontal spacing of elements down the length of a layout, think of a newspaper where content lines up vertically and it just looks 'nice' or 'appropriate', consistent horizontal spacing, gutters, etc... then for web, make those grids fluid using 'em' or 'rem' or 'percentage' units and then your content looks good across many devices.

Grids make it easier to make everything 'line up'.. and not just on the extreme left and right sides of the page. Also, many websites are using grids for their layouts, but if you're viewing the html source of that page it's not always easy and obvious to determine this (unless it's zurb's foundation and almost all of them use the exact same markup).

thanks ! but one can implement grids when we start the project from scratch. But in many cases, you get legacy code, wherein you have to style based on existing CSS. How can we use grids in those cases?

Very true.

It would just need to be rebuilt from what it sounds like. Keep the code for things that need it like button and font and colors, but take any styling that deals with layout, delete it, then bounce between the html and css and add the grid classes that build it back into the layout that you need. I'm not so sure that I'm actually answering your question and for that I apologize, but then again the workflow might also depend on the individual rebuild and how the initial content was structured...

yes i am getting you up to some extent. And i also know it is really tough to answer what i asked, that being is very generic and depends from site to site. Anyway thanks for your response.