Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The grid system in Bootstrap 3 requires a bit of a lateral shift in your thinking from Bootstrap 2. A column in BS2 (<code>col-*</code>) is NOT synonymous with a column in BS3 (<code>col-sm-*</code>, etc), but there is a way to achieve the same result.</p> <p>Check out this update to your fiddle: <a href="http://jsfiddle.net/pjBzY/22/" rel="noreferrer">http://jsfiddle.net/pjBzY/22/</a> (code copied below).</p> <p>First of all, you don't need to specify a col for each screen size if you want 50/50 columns at all sizes. <code>col-sm-6</code> applies not only to small screens, but also medium and large, meaning <code>class="col-sm-6 col-md-6"</code> is redundant (the benefit comes in if you want to change the column widths at different size screens, such as <code>col-sm-6 col-md-8</code>).</p> <p>As for the margins issue, the negative margins provide a way to align blocks of text in a more flexible way than was possible in BS2. You'll notice in the jsfiddle, the text in the first column aligns visually with the text in the paragraph outside the <code>row</code> -- except at "xs" window sizes, where the columns aren't applied.</p> <p>If you need behavior closer to what you had in BS2, where there is padding between each column and there are no visual negative margins, you will need to add an inner-div to each column. See the <code>inner-content</code> in my jsfiddle. Put something like this in each column, and they will behave the way old <code>col-*</code> elements did in BS2.</p> <hr> <p>jsfiddle HTML</p> <pre><code>&lt;div class="container"&gt; &lt;p class="other-content"&gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse aliquam sed sem nec viverra. Phasellus fringilla metus vitae libero posuere mattis. Integer sit amet tincidunt felis. Maecenas et pharetra leo. Etiam venenatis purus et nibh laoreet blandit.&lt;/p&gt; &lt;div class="row"&gt; &lt;div class="col-sm-6 my-column"&gt; Col 1 &lt;p class="inner-content"&gt;Inner content - THIS element is more synonymous with a Bootstrap 2 col-*.&lt;/p&gt; &lt;/div&gt; &lt;div class="col-sm-6 my-column"&gt; Col 2 &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>and the CSS</p> <pre><code>.row { border: blue 1px solid; } .my-column { background-color: green; padding-top: 10px; padding-bottom: 10px; } .my-column:first-child { background-color: red; } .inner-content { background: #eee; border: #999; border-radius: 5px; padding: 15px; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload