1
votes

I'm trying the Responsive Grid System for the first time and having real trouble getting my columns to sit side by side. I'm only using a two column grid for some of the design elements and centered content for the rest.

Here's the relevant bit of html:

<div class="section group" id="about">
   <div class="col span_1_of_2" id="p1">
      <p>Lorem ipsum dolor sit amet</p>
   </div>
   <div class="col span_1_of_2" id="p2">
      <p>Lorem ipsum dolor sit amet</p>
   </div>
</div>

and css:

.section {
clear: both;
padding: 0px;
margin: 0px;}

.col {
display: block;
float: left;
margin: 1% 0 1% 1.6%;}

.span_2_of_2 {
width: 51.8%;}
.span_1_of_2 {
width: 49.2%;}

Why are my columns lying in one column instead of side by side? What am I missing?

(you can find the responsive grid here)


Thanks everybody

3

3 Answers

0
votes

Width problem, here's a Fiddle

.col have margin left 1.6% which gives 100% - 1.6% - 1.6% / 2 = 48.4% for .span_1_of_2 so

.span_1_of_2 {
  width: 48.4%;
}

*Note: This is based on your HTML because you've only used .span_1_of_2, in the Fiddle used both spans and set them to this dimension.

0
votes

51.8 + 49.2 = 101%

Subtract 1 from the first or second.

0
votes

If I were creating a responsive grid, I would make my <div> elements display: inline-block instead of float: left and display: block. That way, if the columns are small enough they will sit next to each other, but if they become too wide the rightmost <div> will go below the other <div>.

http://jsfiddle.net/ZM3bK/