Eixample

The Eixample (pronounced ey-sham-pla) is a district in Barcelona, characterized by it's strict grid system of long straight streets and wide avenues. Inspired by our city, this CSS flexbox grid is made with love by Mobile Jazz.

You can get Eixample from GitHub and via NPM or Bower.

Contents

  1. Technologies
  2. Breakpoints
  3. Containers
  4. Container Modifiers
  5. Rows
  6. Columns
  7. Row Modifiers
  8. Column Modifiers
  9. Display Classes
  10. Support

Technologies

Eixample is built using Compass, if you wish to modify the default grid, you'll need it installed locally to recompile the styles.

Breakpoints

Eixample is a mobile-first responsive grid, which uses four media queries to create layouts for five screen widths xs sm md lg and xl. These media queries are based on minimum widths and scale up.

// Extra small devices (xs)
// 0px +
// No media query

// Small devices (sm)
// 600px +
@media ( min-width: $breakpoint-sm ) {
}

// Medium devices (md)
// 900px +
@media ( min-width: $breakpoint-md ) {
}

// Large devices (lg)
// 1200px +
@media ( min-width: $breakpoint-lg ) {
}

// Extra large devices (xl)
// 1500px +
@media ( min-width: $breakpoint-xl ) {
}

The width of these breakpoints can be customized in sass/_settings.scss

Containers

Containers are used to constrain the width and centralize your content. They are required and set necessary spacing.

Basic Container

The default container will expand up to 1200px wide before centralizing on larger screens. You can customize this width by changing the value of the Sass variable $container-max-width in sass/_settings.scss.

To create a container, use the class .container.

<div class="container">
</div>
Example:

A container

Container Modifiers

There are two additional modifier classes that can be used to change a container's style. You can use these independently, or combine them.

Full-Width Container

Create a full-width container that expands to any screen size by adding the class .fluid.

<div class="container fluid">
</div>
Example:

A full-width, fluid container

Edge to Edge Container

Remove a container's internal padding to create an edge-to-edge style by adding the class .edge.

<div class="container edge">
</div>
Example:

An edge-to-edge container

Full-Width, Edge to Edge Container

Combine both class .fluid and .edge classes to create a full-width, edge to edge container.

<div class="container fluid edge">
</div>
Example:

A full-width, edge-to-edge container

Rows

Rows are required to group columns and should be direct children of containers.

Basic Row

Rows have a fluid width and will expand up to any size. They feature negative margins to ensure proper placement for both LTR and RTL languages.

To create a row, use the class .row.

<div class="container">
    <div class="row">
    </div>
</div>
Example:

A row inside a container

Columns

Columns are used to divide content and should be direct children of rows.

Basic Column

Create a column using the class .column.

<div class="container">
    <div class="row">
        <div class="column">
        </div>
    </div>
</div>
Example:

A column

Column Widths

Eixample has a traditional 12 column layout, available for each of the five breakpoints. Use the base class .column with a combination of sizes classes: .xs-* .sm-* .md-* .lg-* .xl-* with a column span between *-1 and *-12.

Widths don't have to be set for each breakpoint. If no width is set for .xl-* the width for .lg-* will be used instead. This also applies through .md-* .sm-* and finally .xs-*

<div class="container">
    <div class="row">
        <div class="column xs-12 sm-6 md-3 lg-2 xl-3">
        </div>

        <div class="column xs-12 sm-6 md-3 lg-4 xl-3">
        </div>

        <div class="column xs-6 sm-9 md-3 lg-2">
        </div>

        <div class="column xs-6 sm-3 md-3 lg-4">
        </div>
    </div>
</div>
Example:

Column xs-12 sm-6 md-3 lg-2 xl-3

Column xs-12 sm-6 md-3 lg-4 xl-3

Column xs-6 sm-9 md-3 lg-2

Column xs-6 sm-3 md-3 lg-4

Automatic Column Widths

Column widths are entirely optional. If you don't specify a width, the column will size itself according to its content.

You can also enforce this automatic width for specific breakpoints by setting the size class with *-auto.

<div class="container">
    <div class="row">
        <div class="column xs-12 sm-6 md-auto">
        </div>

        <div class="column xs-12 sm-auto md-6">
        </div>
    </div>
</div>
Example:

Column xs-12 sm-6 md-auto

Column xs-12 sm-auto md-6

Row Modifiers

There are many modifier classes you can apply to rows to alter the behavior and position of the columns they hold.

Wraps

The .wrap-* classes allow you to control how and when columns should wrap to new lines.

Wrapping Columns

By default, columns wrap from top to bottom. This can also be set by adding the class .wrap-wrap.

<div class="container">
    <div class="row">
        <div class="column xs-12 sm-6">
        </div>

        <div class="column xs-12 sm-6">
        </div>

        <div class="column xs-12 sm-6">
        </div>

        <div class="column xs-12 sm-6">
        </div>
    </div>
</div>
Example:

Column 1

Column 2

Column 3

Column 4

Reverse Wrap Columns

To reverse the direction of wrapping columns from bottom to top, add the class .wrap-reverse to the row.

<div class="container">
    <div class="row wrap-reverse">
        <div class="column xs-12 sm-6">
        </div>

        <div class="column xs-12 sm-6">
        </div>

        <div class="column xs-12 sm-6">
        </div>

        <div class="column xs-12 sm-6">
        </div>
    </div>
</div>
Example:

Column 1

Column 2

Column 3

Column 4

Stop Columns from Wrapping

To stop columns from wrapping, add the class .wrap-nowrap to the row.

<div class="container">
    <div class="row wrap-nowrap">
        <div class="column xs-12 sm-6">
        </div>

        <div class="column xs-12 sm-6">
        </div>

        <div class="column xs-12 sm-6">
        </div>

        <div class="column xs-12 sm-6">
        </div>
    </div>
</div>
Example:

Column 1

Column 2

Column 3

Column 4

Directions

The .direction-* classes allow you to control the direction of the columns inside a row.

Normal Column Direction

The default direction will be from left-to-right or right-to-left depending on the language direction. This can also be set by adding the class .direction-normal.

<div class="container">
    <div class="row direction-normal">
        <div class="column xs-12 sm-6 md-3">
        </div>

        <div class="column xs-12 sm-6 md-3">
        </div>

        <div class="column xs-12 sm-6 md-3">
        </div>

        <div class="column xs-12 sm-6 md-3">
        </div>
    </div>
</div>
Example:

Column 1

Column 2

Column 3

Column 4

Reverse Column Direction

To reverse the direction of columns, add the class .direction-reverse to the row.

<div class="container">
    <div class="row direction-reverse">
        <div class="column xs-12 sm-6 md-3">
        </div>

        <div class="column xs-12 sm-6 md-3">
        </div>

        <div class="column xs-12 sm-6 md-3">
        </div>

        <div class="column xs-12 sm-6 md-3">
        </div>
    </div>
</div>
Example:

Column 1

Column 2

Column 3

Column 4

Top to Bottom Column Direction

To force columns to wrap down, add the class .direction-down to the row.

<div class="container">
    <div class="row direction-down">
        <div class="column xs-12 sm-6 md-3">
        </div>

        <div class="column xs-12 sm-6 md-3">
        </div>

        <div class="column xs-12 sm-6 md-3">
        </div>

        <div class="column xs-12 sm-6 md-3">
        </div>
    </div>
</div>
Example:

Column 1

Column 2

Column 3

Column 4

Bottom to Top Column Direction

To force columns to wrap up, add the class .direction-up to the row.

<div class="container">
    <div class="row direction-up">
        <div class="column xs-12 sm-6 md-3">
        </div>

        <div class="column xs-12 sm-6 md-3">
        </div>

        <div class="column xs-12 sm-6 md-3">
        </div>

        <div class="column xs-12 sm-6 md-3">
        </div>
    </div>
</div>
Example:

Column 1

Column 2

Column 3

Column 4

Horizontal Alignment

Columns can be horizontally aligned in in various ways with the .align-* classes.

Start Align Columns

By default, the columns start from the side of the row. This can also be set by adding the class .align-start.

<div class="container">
    <div class="row">
        <div class="column xs-12 sm-6 md-3">
        </div>

        <div class="column xs-12 sm-6 md-3">
        </div>
    </div>
</div>
Example:

Column 1

Column 2

End Align Columns

Columns can be aligned to the end of the row by adding the class .align-end.

<div class="container">
    <div class="row align-end">
        <div class="column xs-12 sm-6 md-3">
        </div>

        <div class="column xs-12 sm-6 md-3">
        </div>
    </div>
</div>
Example:

Column 1

Column 2

Centrally Align Columns

Columns can be centrally aligned by adding the class .align-center.

<div class="container">
    <div class="row align-center">
        <div class="column xs-12 sm-6 md-3">
        </div>

        <div class="column xs-12 sm-6 md-3">
        </div>
    </div>
</div>
Example:

Column 1

Column 2

Justify Columns

Columns can be justified to either side of a row by adding the class .align-justify.

<div class="container">
    <div class="row align-justify">
        <div class="column xs-12 sm-6 md-3">
        </div>

        <div class="column xs-12 sm-6 md-3">
        </div>
    </div>
</div>
Example:

Column 1

Column 2

Equally Space Columns

Columns can be equally spaced within the row by adding the class .align-equally.

<div class="container">
    <div class="row align-equally">
        <div class="column xs-12 sm-6 md-3">
        </div>

        <div class="column xs-12 sm-6 md-3">
        </div>
    </div>
</div>
Example:

Column 1

Column 2

Vertical Alignment

Columns can be vertically aligned within a row using the .valign-* classes.

Top Align Columns

By default, the columns start from the top of the row. This can also be set by adding the class .valign-top.

<div class="container">
    <div class="row valign-top">
        <div class="column xs-12 sm-6 md-3">
        </div>

        <div class="column xs-12 sm-6 md-3">
        </div>
    </div>
</div>
Example:

Column 1

Column 2

Bottom Align Columns

Columns can be aligned to the bottom of the row by adding the class .valign-bottom.

<div class="container">
    <div class="row valign-bottom">
        <div class="column xs-12 sm-6 md-3">
        </div>

        <div class="column xs-12 sm-6 md-3">
        </div>
    </div>
</div>
Example:

Column 1

Column 2

Centrally Align Columns Vertically

Columns can be centrally aligned within the row by adding the class .valign-middle.

<div class="container">
    <div class="row valign-middle">
        <div class="column xs-12 sm-6 md-3">
        </div>

        <div class="column xs-12 sm-6 md-3">
        </div>
    </div>
</div>
Example:

Column 1

Column 2

Baseline Align Columns

Columns can be aligned to a united baseline by adding the class .valign-baseline.

<div class="container">
    <div class="row valign-baseline">
        <div class="column xs-12 sm-6 md-3">
        </div>

        <div class="column xs-12 sm-6 md-3">
        </div>
    </div>
</div>
Example:

Column 1

Column 2

Stretch Columns

Columns can be stretched to fill the full height of the row by adding the class .valign-stretch.

<div class="container">
    <div class="row valign-stretch">
        <div class="column xs-12 sm-6 md-3">
        </div>

        <div class="column xs-12 sm-6 md-3">
        </div>
    </div>
</div>
Example:

Column 1

Column 2

Wrap Alignment

Wrapped columns can be vertically aligned using the .valign-wrapped-* classes.

Top Align Wrapped Columns

By default, wrapped columns will be aligned to the top of the row. This can also be set by adding the class .valign-wrapped-top.

<div class="container">
    <div class="row valign-wrapped-top">
        <div class="column xs-8">
        </div>

        <div class="column xs-6">
        </div>
    </div>
</div>
Example:

Column 1

Column 2

Bottom Align Wrapped Columns

Wrapped columns can be aligned to the bottom of a row by adding the class .valign-wrapped-bottom.

<div class="container">
    <div class="row valign-wrapped-bottom">
        <div class="column xs-8">
        </div>

        <div class="column xs-6">
        </div>
    </div>
</div>
Example:

Column 1

Column 2

Centrally Align Wrapped Columns Vertically

Wrapped columns can be vertically aligned to the center of a row by adding the class .valign-wrapped-middle.

<div class="container">
    <div class="row valign-wrapped-middle">
        <div class="column xs-8">
        </div>

        <div class="column xs-6">
        </div>
    </div>
</div>
Example:

Column 1

Column 2

Stretch Wrapped Columns

Wrapped columns can be stretched to fill the full height of a row by adding the class .valign-wrapped-stretch.

<div class="container">
    <div class="row valign-wrapped-stretch">
        <div class="column xs-8">
        </div>

        <div class="column xs-6">
        </div>
    </div>
</div>
Example:

Column 1

Column 2

Justify Wrapped Columns

Wrapped columns can be justified to the top and bottom of a row by adding the class .valign-wrapped-justify.

<div class="container">
    <div class="row valign-wrapped-justify">
        <div class="column xs-8">
        </div>

        <div class="column xs-6">
        </div>
    </div>
</div>
Example:

Column 1

Column 2

Equally Spaced Wrapped Columns

Wrapped columns can be equally spaced within the row by adding the class .valign-wrapped-equally.

<div class="container">
    <div class="row valign-wrapped-equally">
        <div class="column xs-8">
        </div>

        <div class="column xs-6">
        </div>
    </div>
</div>
Example:

Column 1

Column 2

Guttering

Guttering is added to space columns apart by default. This can be removed by adding the class .gutter-remove to a row.

<div class="container">
    <div class="row gutter-remove">
        <div class="column xs-12 sm-6">
        </div>

        <div class="column xs-12 sm-6">
        </div>
    </div>
</div>
Example:

Column 1

Column 2

Column Modifiers

Groups of columns can be aligned using row modifiers and individual columns can be aligned using the following classes.

Vertical Alignment

Like rows, .valign-* classes can be applied to columns to individually align a single column.

Top Align a Column

By default, columns start from the top of a row. This can also be set by adding the class .valign-top to the column.

<div class="container">
    <div class="row">
        <div class="column xs-12 sm-6 md-3">
        </div>

        <div class="column xs-12 sm-6 md-3 valign-top">
        </div>

        <div class="column xs-12 sm-6 md-3">
        </div>

        <div class="column xs-12 sm-6 md-3">
        </div>
    </div>
</div>
Example:

Column 1

Column 2

Column 3

Column 4

Bottom Align a Column

To align a single column to the bottom of a row, add the class .valign-bottom.

<div class="container">
    <div class="row">
        <div class="column xs-12 sm-6 md-3">
        </div>

        <div class="column xs-12 sm-6 md-3 valign-bottom">
        </div>

        <div class="column xs-12 sm-6 md-3">
        </div>

        <div class="column xs-12 sm-6 md-3">
        </div>
    </div>
</div>
Example:

Column 1

Column 2

Column 3

Column 4

Centrally Align a Column Vertically

To vertically align a single column to the middle of a row, add the class .valign-middle.

<div class="container">
    <div class="row">
        <div class="column xs-12 sm-6 md-3">
        </div>

        <div class="column xs-12 sm-6 md-3 valign-middle">
        </div>

        <div class="column xs-12 sm-6 md-3">
        </div>

        <div class="column xs-12 sm-6 md-3">
        </div>
    </div>
</div>
Example:

Column 1

Column 2

Column 3

Column 4

Baseline Align a Column

To align individual columns to the baseline, add the class .valign-baseline.

<div class="container">
    <div class="row">
        <div class="column xs-12 sm-6 md-3 valign-baseline">
        </div>

        <div class="column xs-12 sm-6 md-3 valign-baseline">
        </div>

        <div class="column xs-12 sm-6 md-3 valign-baseline">
        </div>

        <div class="column xs-12 sm-6 md-3">
        </div>
    </div>
</div>
Example:

Column 1

Column 2

Column 3

Column 4

Stretch a Column

To stretch a single column to the full height of the row, add the class .valign-stretch.

<div class="container">
    <div class="row">
        <div class="column xs-12 sm-6 md-3">
        </div>

        <div class="column xs-12 sm-6 md-3 valign-stretch">
        </div>

        <div class="column xs-12 sm-6 md-3">
        </div>

        <div class="column xs-12 sm-6 md-3">
        </div>
    </div>
</div>
Example:

Column 1

Column 2

Column 3

Column 4

Display Classes

Display classes are column modifiers to show/hide columns on specific screen sizes.

Hide a Column

Combine the .*-hide class with .xs-* .sm-* .md-* .lg-* .xl-* to hide an inidivual column at that screen size. It will be shown on all other screen sizes.

<div class="container">
    <div class="row">
        <div class="column xs-hide">
        </div>

        <div class="column sm-hide">
        </div>

        <div class="column md-hide">
        </div>

        <div class="column lg-hide">
        </div>

        <div class="column xl-hide">
        </div>
    </div>
</div>
Example:

Hide on extra small screens

Hide on small screens

Hide on medium screens

Hide on large screens

Hide on extra large screens

Show a Column

Combine the .*-show class with .xs-* .sm-* .md-* .lg-* .xl-* to display a column only on that screen size. It will be hidden on all other screen sizes.

<div class="container">
    <div class="row">
        <div class="column xs-show">
        </div>

        <div class="column sm-show">
        </div>

        <div class="column md-show">
        </div>

        <div class="column lg-show">
        </div>

        <div class="column xl-show">
        </div>
    </div>
</div>
Example:

Show on extra small screens

Show on small screens

Show on medium screens

Show on large screens

Show on extra large screens

Support

If you're having any issues with Exiample, we're here to help. Please make sure you've read through this documentation and check your browser supports flexbox at Can I Use.

If you need support or have found a bug, please raise an issue on GitHub and we'll get right back to you.