st88 st88 - 5 months ago 21
CSS Question

Responsive Webdesign / Foundation: Changing the vertical order of columns possible?

I have made this three columns layout using ZURB Foundation:



<link href="https://cdn.jsdelivr.net/foundation/6.2.0/foundation.min.css" rel="stylesheet"/>
<div class="wrap">
<div class="row">
<div class="large-3 columns left-column">
<ul>
<li>One</li>
<li>Two</li>
<li>Three</li>
<li>Four</li>
</ul>
</div>
<div class="content large-6 columns">
<h2>Nam quam nunc blandit vel</h2>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim.</p>
<p>Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus.</p>
</div>
<div class="right-column large-3 columns">
<p>RIGHT COLUMN - Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus.</p>
<p>Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum.</p>
</div>
</div>





The behaviour is quite alright.

When the screen becomes smaller then it changes from one row with three columns to stacked columns.
Order: Left-column, then content-area, then right-column.

But optimal would be:


  • Left- and right-column get 6 columns each (sum up to 12).

  • Content gets 12.

  • AND order would be: Left- and right-column side by side. Then comes the content-area having full width.



Is such a rearrangement (with modest effort) possible?

Answer

You can achieve this using pull and push class. like this :

<link href="https://cdn.jsdelivr.net/foundation/6.2.0/foundation.min.css" rel="stylesheet"/>
<div class="wrap">
  <div class="row">
<div class="small-6 medium-3 large-3 columns left-column">
  <ul>
    <li>One</li>
    <li>Two</li>
    <li>Three</li>
    <li>Four</li>
  </ul>
</div>
<div class="small-6 right-column medium-3 large-3 medium-push-6  columns">
  <p>RIGHT COLUMN - Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus.</p>
  <p>Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum.</p>
</div>
<div class="content medium-6 large-6 medium-pull-3 columns">
  <h2>Nam quam nunc blandit vel</h2>
  <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim.</p>
  <p>Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus.</p>
</div>
<div class="small-6 right-column large-3 columns">
  <p>RIGHT COLUMN - Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus.</p>
  <p>Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum.</p>
</div>
</div>