33 | Jazzing Up Layouts with Columns |
Say we want to make our website look more like a newspaper. We want to turn our boring one-column paragraph into multiple columns. This is a lot easier with Compass.
We have the option to apply any number of columns. We can use two extra mixins to define the width of each column as well as the gap between each column.
If necessary, we can add a line to separate the columns of text. The declarations we use are the same as what we would use for describing a regular border, namely the width, style, and color.
It’s important to note that columns aren’t really supported in older versions of Internet Explorer. Also, the column attribute doesn’t really like it if you define heights.
What To Do... |
compass/columns.scss | |
| #two_columns { |
| @include column-count(2); |
| width: 300px; } |
| @include column-width(240px); |
| @include column-gap(24px); |
compass/columns.scss | |
| #columns_borders { |
| @include column-count (3); |
| @include column-rule(2px, dashed, #336699); |
| width: 300px; } |
Task 35, Producing More Two-Column Layouts