Grid / Layout Grid

Framework7 comes with flexible layout grid that allows you place your content as you need.

Grid Layout

<!-- Each "cells" row should be wrapped with div class="row" -->
<div class="row">
    <!-- Each "cell" has col-[width in percents] class -->
    <div class="col-50">50%</div>
    <div class="col-50">50%</div>
</div>
<div class="row">
    <!-- Each "cell" has col-[width in percents] class -->
    <div class="col-33">33%</div>
    <div class="col-33">33%</div>
    <div class="col-33">33%</div>
</div>

By defaul all "cells" has 15px gap between each other for iOS theme and 16px gap for MD theme. If you want "cells" without gap, you should add additional no-gap class to "row":

<!-- Additional "no-gap" class on row to remove space between cells -->
<div class="row no-gap">
    <!-- Each "cell" has col-[width in percents] class -->
    <div class="col-50">50%</div>
    <div class="col-50">50%</div>
</div>
<div class="row">
    <!-- Each "cell" has col-[width in percents] class -->
    <div class="col-33">33%</div>
    <div class="col-33">33%</div>
    <div class="col-33">33%</div>
</div>

Column Sizes

The following columns size are available:

ClassTablet Class
width >= 768px
Desktop Class
width >= 1025px
Width
col-5tablet-5desktop-55%
col-10tablet-10desktop-1010%
col-15tablet-15desktop-1515%
col-20tablet-20desktop-2020%
col-25tablet-25desktop-2525%
col-30tablet-30desktop-3030%
col-33tablet-33desktop-3333.333333333333336%
col-35tablet-35desktop-3535%
col-40tablet-40desktop-4040%
col-45tablet-45desktop-4545%
col-50tablet-50desktop-5050%
col-55tablet-55desktop-5555%
col-60tablet-60desktop-6060%
col-65tablet-65desktop-6565%
col-66tablet-66desktop-6666.66666666666666%
col-70tablet-70desktop-7070%
col-75tablet-75desktop-7575%
col-80tablet-80desktop-8080%
col-85tablet-85desktop-8585%
col-90tablet-90desktop-9090%
col-95tablet-95desktop-9595%
col-100tablet-100desktop-100100%
coltablet-autodesktop-autoEqual width

CSS Variables

Below is the list of related CSS variables (CSS custom properties).

.ios {
  --f7-grid-gap: 15px;
}
.md {
  --f7-grid-gap: 16px;
}
.aurora {
  --f7-grid-gap: 15px;
}

Examples

By default grid columns (cells) has no any visual styles, we'll add them for this demo:

div[class*="col"] {
  background: #fff;
  text-align: center;
  color: #000;
  border: 1px solid #ddd;
  padding: 5px;
  margin-bottom: 15px;
  font-size: 12px;
}
<div class="block-title">Columns with gap</div>
<div class="block">
  <div class="row">
    <div class="col">50% (.col)</div>
    <div class="col">50% (.col)</div>
  </div>
  <div class="row">
    <div class="col">25% (.col)</div>
    <div class="col">25% (.col)</div>
    <div class="col">25% (.col)</div>
    <div class="col">25% (.col)</div>
  </div>
  <div class="row">
    <div class="col">33% (.col)</div>
    <div class="col">33% (.col)</div>
    <div class="col">33% (.col)</div>
  </div>
  <div class="row">
    <div class="col">20% (.col)</div>
    <div class="col">20% (.col)</div>
    <div class="col">20% (.col)</div>
    <div class="col">20% (.col)</div>
    <div class="col">20% (.col)</div>
  </div>
  <div class="row">
    <div class="col-33">33% (.col-33)</div>
    <div class="col-66">66% (.col-66)</div>
  </div>
  <div class="row">
    <div class="col-25">25% (.col-25)</div>
    <div class="col-25">25% (.col-25)</div>
    <div class="col-50">50% (.col-50)</div>
  </div>
  <div class="row">
    <div class="col-75">75% (.col-75)</div>
    <div class="col-25">25% (.col-25)</div>
  </div>
  <div class="row">
    <div class="col-80">80% (.col-80)</div>
    <div class="col-20">20% (.col-20)</div>
  </div>
</div>
<div class="block-title">No gap between columns</div>
<div class="block">
  <div class="row no-gap">
    <div class="col">50% (.col)</div>
    <div class="col">50% (.col)</div>
  </div>
  <div class="row no-gap">
    <div class="col">25% (.col)</div>
    <div class="col">25% (.col)</div>
    <div class="col">25% (.col)</div>
    <div class="col">25% (.col)</div>
  </div>
  <div class="row no-gap">
    <div class="col">33% (.col)</div>
    <div class="col">33% (.col)</div>
    <div class="col">33% (.col)</div>
  </div>
  <div class="row no-gap">
    <div class="col">20% (.col)</div>
    <div class="col">20% (.col)</div>
    <div class="col">20% (.col)</div>
    <div class="col">20% (.col)</div>
    <div class="col">20% (.col)</div>
  </div>
  <div class="row no-gap">
    <div class="col-33">33% (.col-33)</div>
    <div class="col-66">66% (.col-66)</div>
  </div>
  <div class="row no-gap">
    <div class="col-25">25% (.col-25)</div>
    <div class="col-25">25% (.col-25)</div>
    <div class="col-50">50% (.col-50)</div>
  </div>
  <div class="row no-gap">
    <div class="col-75">75% (.col-75)</div>
    <div class="col-25">25% (.col-25)</div>
  </div>
  <div class="row no-gap">
    <div class="col-80">80% (.col-80)</div>
    <div class="col-20">20% (.col-20)</div>
  </div>
</div>
<div class="block-title">Nested</div>
<div class="block">
  <div class="row">
    <div class="col">50% (.col)
      <div class="row">
        <div class="col">50% (.col)</div>
        <div class="col">50% (.col)</div>
      </div>
    </div>
    <div class="col">50% (.col)
      <div class="row">
        <div class="col-33">33% (.col-33)</div>
        <div class="col-66">66% (.col-66)</div>
      </div>
    </div>
  </div>
</div>
<div class="block-title">Responsive Grid</div>
<div class="block">
  <p>Grid cells have different size on Phone/Tablet</p>
  <div class="row">
    <div class="col-100 tablet-50">.col-100.tablet-50</div>
    <div class="col-100 tablet-50">.col-100.tablet-50</div>
  </div>
  <div class="row">
    <div class="col-50 tablet-25">.col-50.tablet-25</div>
    <div class="col-50 tablet-25">.col-50.tablet-25</div>
    <div class="col-50 tablet-25">.col-50.tablet-25</div>
    <div class="col-50 tablet-25">.col-50.tablet-25</div>
  </div>
  <div class="row">
    <div class="col-100 tablet-40">.col-100.tablet-40</div>
    <div class="col-50 tablet-60">.col-50.tablet-60</div>
    <div class="col-50 tablet-66">.col-50.tablet-66</div>
    <div class="col-100 tablet-33">.col-100.tablet-33</div>
  </div>
</div>