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

Ruby Build a Simple Ruby on Rails Application Customizing Forms Adding Styling

Edward Poon
Edward Poon
9,313 Points

How does span and row works and fit together.

Can you explain to me what the span4 and row do? How are they interacting with each other and why do we have a span 8 at the bottom?

1 Answer

Alex Heil
Alex Heil
53,547 Points

hey Edward Poon , the row and span classes define the structure of the layout. think about it like this:

the row is sort of your wrapper, the starting point for your grip. once you have this defined then with the span classes you can set up the width of each element.

the bootstrap grip is made of 12 columns - so say you want a 2 column layout where both blocks are the same width you would give the first element a span6 and the second one also a span6 - because 6 + 6 = 12

this applies to all sorts of variations. if you want a sidebar for example that should take about 25% (1/4th of the page) then 1/4th of the grip (which is always 12 again) would be 3. so you would add the class span3.

hope this helped and have a nice day ;)