Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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

Making a Sidebar

Using the offset and grid columns, how would I make a setup with a main area that spans about 75% of the page and a right sidebar spanning the other 25%?

1 Answer

Hey Chase, Using the Bootstrap grid and predefined classes and you can do what you want using code like this.

<div class="row">
    <div class="col-sm-9">
    This is the the left part of your row spanning 75% of the page. With Bootstrap, there are a total of 12 columns, and 9 columns is equal to 75% of the total.
    </div>
    <div class="col-sm-3">
    This will be the side bar, or the right side of your row, spanning 25% of the page, or three columns. These columns will stack on top of each other in small and extra small devices.  In devices bigger than "small" devices they will be together in the same row.
    </div>
</div>