1
1
mirror of https://github.com/primer/css.git synced 2024-12-01 04:21:12 +03:00
css/docs/layout.md
Chris McKay 8f4939df28 Update layout.md
Grammar fix
2015-03-24 22:57:05 -04:00

77 lines
1.8 KiB
Markdown

---
layout: page
title: Layout
---
Primer's layout includes basic page containers and a single-tiered, fraction-based grid system. That sounds more complicated than it really is though—it's just containers, rows, and columns.
You can find all the below styles in `_layout.scss`.
## Contents
* Will be replaced with the ToC, excluding the "Contents" header
{:toc}
## Container
Center your page's contents with a `.container`.
{% highlight html %}
<div class="container">
<!-- contents here -->
</div>
{% endhighlight %}
The container applies `width: 980px;` and uses horizontal `margin`s to center it.
## Grid
The grid is pretty standard—you create rows with `.columns` and individual columns with a column class and fraction class. Here's how it works:
- Add a `.container` to encapsulate everything and provide ample horizontal gutter space.
- Create your outer row to clear the floated columns with `<div class="columns">`.
- Add your columns with individual `<div class="column">`s.
- Add your fractional width classes to set the width of the columns (e.g., `.one-fourth`).
In practice, your columns will look like the example below.
{% example html %}
<div class="container">
<div class="columns">
<div class="one-fifth column">
.one-fifth
</div>
<div class="four-fifths column">
.four-fifths
</div>
</div>
<div class="columns">
<div class="one-fourth column">
.one-fourth
</div>
<div class="three-fourths column">
.three-fourths
</div>
</div>
<div class="columns">
<div class="one-third column">
.one-third
</div>
<div class="two-thirds column">
.two-thirds
</div>
</div>
<div class="columns">
<div class="one-half column">
.one-half
</div>
<div class="one-half column">
.one-half
</div>
</div>
</div>
{% endexample %}