← Superkube / Documentation 2.1.1
Modules

Container

This module helps to set the maximum width of an element and to set padding at its edges.

Named #

Superkube automatically generates containers specified in $scales map.


container: (
    small: 400px,
    medium: 960px,
    base: 1144px,
    large: 1200px,
    content: 800px,
    full: 100%
)

As a result Superkube will generate the following classes for containers:

  • container-small
  • container-medium
  • container (without suffix for base size)
  • container-large
  • container-content
  • container-full

You can use them to wrap the content, other modules and set them to their maximum width.


<div class="container">...</div>
<div class="container-medium">...</div>
<div class="container-large">...</div>

Each container gets the max-width property specified in $scales. For example, for a base container the generated class may look like this:


.container {
    max-width: 1144px;
}

The container can be mixed with other modules or blocks inside them.


<div class="item container-medium">
    <div class="item-head">...</div>
    <div class="item-body container-small">...</div>
</div>

Add container

To add your container size, you need to extend the $scales map.


// Scales
$scales: map-extend($scales, (
    container: (
        form: 450px
    )
));

Superkube will generate a container with class container-form


<div class="container-form">...</div>

Columns #

The width of the containers can be specified by the number of columns. The number and parameters of columns are defined in $grid params. By default, there are 12 columns with gutter of 6rem between them.


// =Scales
$scales: (
    grid: (
        gridname: grid,
        columnname: column,
        columns: 12,
        gutter: 6rem,
        gap: 6rem
    )
);

Superkube will generate containers based on the number of columns and gutter between them. In the end you can use them like this:


<div class="container-1">...</div>
<div class="container-2">...</div>
...
<div class="container-11">...</div>
<div class="container-12">...</div>

Edges #

Containers may have padding at the edges. This is specified in the $scales map. By default, the left and right padding for the container edges is 5rem.


edge: (
    base: 5rem
)

Superkube will generate the necessary classes to specify the size of the container edges. This means that by applying these classes you will set padding-left and padding-right on the container.


<div class="container edges">...</div>

Add edge

You can add your own padding size at the edges extending the $scales map.


// Scales
$scales: map-extend($scales, (
    edge: (
        large: 8rem
    )
));

Use it in HTML.


<div class="container edges-large">...</div>

Centered #

Use the Centered module to make the container horizontally centered.


<div class="container edges centered">...</div>

Responsive #

All containers on small screens become 100% wide, i.e. the max-width property becomes none.

For edges you can control how padding-left and padding-right will be set for the container by adding the suffix -sm on small screens.

  • edges-off-sm — turns off edges on small screens;
  • edges-sm (base) — turns on edges with the base size;
  • edges-{size}-sm — turns on a custom defined edges, e.g. edges-large-sm.

<div class="container edges edges-off-sm">...</div>
<div class="container edges-large edges-sm">...</div>