CSS3 can design text content in a multi-column layout like a newspaper, as shown in the following example:
This website introduces the basic knowledge of HTML, CSS, Javascript, Python,Java,Ruby,C,PHP, MySQL and other programming languages. At the same time, this site also provides a large number of online examples, through examples, you can better learn programming. The numbers in the table represent the version number of the first browser that supports the method. Immediately after the number. Attribute Column-count 4.0-webkit- 10.0 2.0 -moz- 3.1 -webkit- 15.0-webkit- 11.1 Column-gap 4.0-webkit- 10.0 2.0 -moz- 3.1 -webkit- 15.0-webkit- 11.1 Column-rule 4.0-webkit- 10.0 2.0 -moz- 3.1 -webkit- 15.0-webkit- 11.1 Column-rule-color 4.0-webkit- 10.0 2.0 -moz- 3.1 -webkit- 15.0-webkit 11.1 Column-rule-style 4.0-webkit- 10.0 2.0 -moz- 3.1 -webkit- 15.0-webkit 11.1 Column-rule-width 4.0-webkit- 10.0 2.0 -moz- 3.1 -webkit- 15.0-webkit 11.1 Column-width 4.0-webkit- 10.0 2.0 -moz- 3.1 -webkit- 15.0-webkit 11.1 In this section, we will learn about the following multi-column properties of CSS3: The following example will Example The following example specifies that the gap between columns is 40 pixels: Example Example Example Example The The following example sets the thickness, style, and color of the direct border of the column: Example The following example specifies Example The following table lists the multi-column properties of all CSS3: Attribute Description Column-count Specifies the number of columns that the element should be split into. Column-fill Specify how to populate the column Column-gap Specify the gap between columns Column-rule Abbreviations for all column-rule-* attributes Column-rule-color Specify the color of the border between the two columns Column-rule-style Specify the style of the border between the two columns Column-rule-width Specify the thickness of the border between the two columns Column-span Specify how many columns the element should span Column-width Specify the width of the column Columns Abbreviated properties of column-width and column-count. 8.14.1. Browser support ¶
-webkit-
or
-moz-
specifies the prefix for the browser. 8.14.2. CSS3 multi-column properties ¶
column-count
column-gap
column-rule-style
column-rule-width
column-rule-color
column-rule
column-span
column-width
8.14.3. CSS3 creates multiple columns ¶
column-count
property specifies the number of columns to be split.
<div>
the text in the element is divided into three columns:div{
-webkit-column-count:3; /\* Chrome, Safari, Opera \*/
-moz-column-count:3; /\* Firefox \*/
column-count:3;
}
8.14.4. The gap between columns in CSS3 multiple columns ¶
column-gap
property specifies the gap between columns.div{
-webkit-column-gap:40px; /\* Chrome, Safari, Opera \*/
-moz-column-gap:40px; /\* Firefox \*/
column-gap:40px;
}
8.14.5. CSS3 column border ¶
column-rule-style
property specifies the border style between columns:div{
-webkit-column-rule-style:solid; /\* Chrome, Safari, Opera \*/
-moz-column-rule-style:solid; /\* Firefox \*/
column-rule-style:solid;
}
column-rule-width
property specifies the border thickness of two columns:div{
-webkit-column-rule-width:1px; /\* Chrome, Safari, Opera \*/
-moz-column-rule-width:1px; /\* Firefox \*/
column-rule-width:1px;
}
column-rule-color
property specifies the border color of two columns:div{
-webkit-column-rule-color:lightblue; /\* Chrome, Safari, Opera \*/
-moz-column-rule-color:lightblue; /\* Firefox \*/
column-rule-color:lightblue;
}
column-rule
property is
column-rule-\*
abbreviations for all attributes.div{
-webkit-column-rule:1px solid lightblue; /\* Chrome, Safari, Opera
\*/
-moz-column-rule:1px solid lightblue; /\* Firefox \*/
column-rule:1px solid lightblue;
}
8.14.6. Specify how many columns the element spans ¶
<h2>
element spans all columns:h2{
-webkit-column-span:all; /\* Chrome, Safari, Opera \*/
column-span:all;
}
8.14.7. Specify the width of the column ¶
column-width
property specifies the width of the column.Example ¶
div{
-webkit-column-width:100px; /\* Chrome, Safari, Opera \*/
column-width:100px;
}
8.14.8. CSS3 multi-column properties ¶