English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

CSS reference manual

CSS @rules

CSS attributes大全

CSS3 column-rule Attribute Usage and Example

olumn-rule CSS attribute specifies a line to be drawn between each column, that is, 'rule'. It is a shorthand attribute for setting a single property, that is, settingcolumn-rule-width,column-rule-styleandcolumn-rule-color.

The following table provides usage instructions and version history of this attribute, as well as its usage syntax in JavaScript scripts.

Default Value:View All Properties
Applies To:Multi-column Elements
Inheritance:None
Animatable:Yes, because some properties of shorthand can be animated.Please refer to Animation Attributes.
Version: CSS3new feature
JavaScript Syntax:object.style.columnRule="3px outset #ff00ff"

column-rule Usage Syntax

The syntax of this attribute is as follows:

column-rule: [ column-rule-width column-rule-style column-rule-color [ ] | initial | inherit

The following example demonstrates how to use column-rule Attribute.

p {
    /* Chrome, Safari, Opera */
    -webkit-column-count: 3;
    -webkit-column-gap: 100px;
    -webkit-column-rule: 2px solid red;
    /* Firefox */
    -moz-column-count: 3;
    -moz-column-gap: 100px;
    -moz-column-rule: 2px solid red;
    
    column-count: 3;
    column-gap: 100px;
    column-rule: 2px solid red;
}
Test See‹/›

Attribute Values

The following table describes the values of this attribute.

ValueDescription
column-rule-widthSet the rule width between columns. The default value is medium. Negative values are not allowed.
column-rule-styleSet the rule style between columns. The default value is none.
column-rule-colorSet the rule color between columns. The default value iscolorof the element.
initialSet this attribute to its default value.
inheritIf specified, the associated elements adopt the column of their parent element.-rule Attribute Values.

Browser Compatibility

column-Browser Compatibility of rule Attribute, the numbers in the following table represent the minimum version number of the browsers that support this attribute; all mainstream browsers support this attribute.

  • Firefox 2+ -moz-

  • Google Chrome 4+ -webkit-

  • Internet Explorer 10+

  • Apple Safari 3.1+ -webkit-

  • Opera 11.1+ -o-,15+ -webkit-

Further Reading

Please refer to the following tutorials:CSS3Multi-column Layout.

Related Attributes:column-width,column-fill,column-gap,column-rule-width,column-rule-style,column-rule-color,column-span,column-count,columns.