Columns
Columns are building blocks for many websites. Here's how columns are formed in Kube, and here's how you can use them right away.
<div class="row">
<div class="col col-4">...</div>
<div class="col col-8">...</div>
</div>
Gutters
<div class="row gutters">
<div class="col col-3">...</div>
<div class="col col-9">...</div>
</div>
Auto Width
<div class="row auto">
<div class="col">...</div>
<div class="col">...</div>
<div class="col">...</div>
</div>
Auto + Gutters
<div class="row gutters auto">
<div class="col">...</div>
<div class="col">...</div>
<div class="col">...</div>
<div class="col">...</div>
</div>
Bricks
<div class="row">
<div class="col col-6">...</div>
<div class="col col-6">...</div>
<div class="col col-6">...</div>
<div class="col col-6">...</div>
</div>
Bricks + Gutters
<div class="row gutters">
<div class="col col-4">...</div>
<div class="col col-4">...</div>
<div class="col col-4">...</div>
<div class="col col-4">...</div>
</div>
Offset
Offsetting columns is very simple in Kube. Just use column's class as usual, for example, col col-2
and then add the offset value offset-4
. This will offset this column and all following columns by 4.
<div class="row">
<div class="col col-2">...</div>
<div class="col col-6 offset-4">...</div>
</div>
Nested
Here's an example of nesting columns within columns. In this example, we have a single row, with two columns .col col-6, a div nested within the second column, with .row end class to denote where to inject nested columns, and the three nested columns.
<div class="row">
<div class="col col-6">...</div>
<div class="col col-6">
<div class="row">
<div class="col col-4">...</div>
<div class="col col-4">...</div>
<div class="col col-4">...</div>
</div>
</div>
</div>
Equal Height Columns
Columns are equal height by default in Kube
2
3
<div class="row">
<div class="col col-6">
...
</div>
<div class="col col-6">
...
...
...
</div>
</div>
Reordering
First
<div class="row">
<div class="col col-4">...</div>
<div class="col col-8 first">...</div>
</div>
Last
<div class="row">
<div class="col col-3 last">...</div>
<div class="col col-9">...</div>
</div>
Around
When you want your columns to be surrounded by an even margins on both sides, just use .around
class.
<div class="row around">
<div class="col col-3">...</div>
<div class="col col-3">...</div>
<div class="col col-3">...</div>
</div>
Between
Sometime you just need space between columns, and not around them. Well, there's a class for that: .between
<div class="row between">
<div class="col col-3">...</div>
<div class="col col-3">...</div>
<div class="col col-3">...</div>
</div>
Alignment
Align Center
<div class="row align-center">
<div class="col col-6">...</div>
</div>
Align Right
<div class="row align-right">
<div class="col col-3">...</div>
<div class="col col-3">...</div>
</div>
Align Middle
<div class="row align-middle">
<div class="col col-4">...</div>
<div class="col col-4">...</div>
<div class="col col-4">...</div>
</div>
Push
Push Center
<div class="row">
<div class="col col-4 push-center">...</div>
</div>
Push Right
<div class="row">
<div class="col col-6">...</div>
<div class="col col-4 push-right">...</div>
</div>
Push Middle
<div class="row">
<div class="col col-8 push-middle">...</div>
</div>
Push Mixed
<div class="row">
<div class="col col-8 push-middle push-center">...</div>
</div>
Push Bottom
<div class="row">
<div class="col col-8 push-bottom">...</div>
</div>
Fixed Width Column
Here's one more bit of magic. You can set a fixed width column and still have a responsive and flexible layout right beside this fixed width column.
<!-- scss -->
#container {
@include grid-row;
}
#sidebar {
@include flex-item-width(300px);
}
#content {
@include flex-item-auto;
}
<!-- html -->
<div id="container">
<div id="sidebar">Sidebar</div>
<div id="content">Content</div>
</div>
Media Grid
Media grid is a great example of Kube's flexibility and versatility. Whenever you have some media to display, you can choose to use Media grid. This type of grid is ideal for featuring photos; it adds some visual music and slight randomness to your layout.
<!-- scss -->
#media-grid {
@include grid-media-columns(2);
& > div {
margin-bottom: 20px;
height: 80px;
}
& > div:nth-child(2n) {
height: 200px;
}
& > div:nth-child(5n) {
height: 120px;
}
}
<!-- html -->
<div id="media-grid">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
<div>7</div>
<div>8</div>
<div>9</div>
<div>10</div>
</div>