Search code examples
csssasszurb-foundation-5

Foundation 5 grid row nesting negative margin


I've got this weird problem in Zurb Foundation 5. Whenever i nest row inside rows, it produces negative margin, throwing it out of a grid. Here's example markup of my code:

<div class="row main-content">
    <div class="row">
        <div class="breadcrumbs columns small-12">My account / Companies list /</div>
        <div class="columns small-6 heading-container">
            <h1>Create new company</h1>
        </div>
    </div>
</div>

And this is the code, that foundation produces:

.row .row {
    width: auto;
    margin-left: -0.9375rem;
    margin-right: -0.9375rem;
    margin-top: 0;
    margin-bottom: 0;
    max-width: none;
}

How do i prevent this behaviour? Is there something wrong with my markup, or should i override the foundation scss (but i don't want to override default styles).


Solution

  • You need to nest inside a row i.e.

    <div class="row">
      <div class="breadcrumbs small-12 columns">
         My account / Companies list /
        <div class="row">
        <div class="Heading-container small-6 columns">
          <h1>Create new company</h1>
        </div>
       </div> <!--/nested row-->
     </div>
    </div><!--/row-->