CSSMultiple Columns
CSS Multi-column Layout
The CSS Multi-column Layout Module allows easy definition of multiple columns of text - just like in newspapers:
Multi Column
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreetdolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipitlobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velitesse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissimqui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum solutanobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum.CSS Multi-column Properties
In this chapter you will learn about the following multi-column properties:
column-countcolumn-gapcolumn-rule-stylecolumn-rule-widthcolumn-rule-colorcolumn-rulecolumn-spancolumn-width
CSS Create Multiple Columns
The CSScolumn-count property specifies the number of columns an element should be divided into.
CSS Column Gap
The CSScolumn-gap property specifies the space between the columns.
CSS Column Rule
The CSScolumn-rule-style property specifies the style of the vertical rule between columns:
The CSScolumn-rule-width property specifies the width of the vertical rule between columns:
The CSScolumn-rule-color property specifies the color of the vertical rule between columns:
The CSScolumn-rule property is a shorthand property for setting all the column-rule-* properties above.
Example
Sets the width, style, and color of the vertical rule between columns:
column-rule: 1px solid lightblue;
}
CSS Column Span
The CSScolumn-span property specifies how many columns an element (typically a heading) should span across.
Example
Specify that the <h2> element should span across all columns (and be aligned in center):
column-span: all;
text-align: center;
}
CSS Column Width
The CSScolumn-width property specifies a suggested, optimal width for each column.
Here, the browser will determine the number of columns based on this width and the available space.
Example
Specify that the suggested, optimal width for the columns should be 100px:
column-width: 100px;
}
CSS Multi-columns Properties
The following table lists all the multi-columns properties:
| Property | Description |
|---|---|
| column-count | Specifies the number of columns an element should be divided into |
| column-fill | Specifies how to fill columns |
| column-gap | Specifies the gap between the columns |
| column-rule | A shorthand property for setting all the column-rule-* properties |
| column-rule-color | Specifies the color of the rule between columns |
| column-rule-style | Specifies the style of the rule between columns |
| column-rule-width | Specifies the width of the rule between columns |
| column-span | Specifies how many columns an element should span across |
| column-width | Specifies a suggested, optimal width for the columns |
| columns | A shorthand property for setting column-width and column-count |

