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

CSS Framework Basics Prototyping with Bootstrap Working with Nested Grids and Responsive Images

Why use Col offset when you can just "pull-right"?

Guil Offsets one of the columns in the row to the right by using the code "col-sm-offset-4"

Instead of dong that? couldnt you just do

<div class="col-sm-4 pull-right">

2 Answers

Sean T. Unwin
Sean T. Unwin
28,690 Points

Yep, you could. :-)

There is almost always more than one way to do something, particularly with regards to front-end development. That being said, I believe a reason Guil Hernandez is showing the offset capabilities of Bootstrap is because this allows a little more explanation to the reader of the code, i.e. it's explicit -- we want to offset by 6 columns, whereas pull-right, to me at least, does not have the same descriptiveness in the overall design pattern.

For the case described in the video there is only 2 columns so pull-right is definitely a valid option, however if there were 3 or more columns then pull-right may not be the best way to go. For example, it would limit the scalability of the content of that section of the page such as for a really wide-screen display option. Perhaps, that is not a terrific example, but I hope the point comes across regardless.

Ian Svoboda
Ian Svoboda
16,639 Points

Pull is designed to alter the layout flow, whereas offset is designed to make something sit on another side of the page.

In other words, you would only be using a pull class if you wanted to (for instance) force an element that would normally appear on the left of another element, to appear on the right.

Even the section that describes this is called: Column Ordering. This if nothing else is a great descriptor for what those classes are for.

http://getbootstrap.com/css/#grid-column-ordering

See the example they provide there and you can see a visual example.