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!

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

CSS

CSS grid

The grid.css file used for the Smells Like Bakin site includes .clear and .clearfix class selectors at the bottom, but only .clearfix has been included within the html container div. Is it necessary to include both?

3 Answers

Staffan Mowitz
Staffan Mowitz
17,079 Points

Those classes derives from the 960 grid system which offers two ways to clear rows.

The .clear class is supposed to be used on a empty div that you add after the last div in your row to clear it. The .clearfix class, however, is supposed to be used on the actual last div in your row to clear it.

You can choose which method you want to use and only include the CSS for that.

I don't see any reason why you would wanna use the first method though, since it would mean that you have to add extra (non-semantic) elements to your HTML-code.

Matthew Underhill
Matthew Underhill
19,424 Points

Hi Rob,

Some of those fixes at the bottom are mainly for Internet Explorer compatibility. Clearing can be an annoying issue across different browser versions. Those fixes help resolve some of the inconsistencies in your web pages.

Thank you both for your reply. My aim was to simply modify the grid structure of the Smells Like Bakin grid.css file to use on another site, and at the same time remove anything that was not necessary.

So from your feedback, it sounds like it would be better to keep the .clearfix class and remove the .clear

Many thanks for your help, Rob