CSS - column-rule Property



The CSS property column-rule is a shorthand property that sets the width, style, and color of the line that is drawn between the columns in a multiple-column layout.

column-rule is a shorthand for following properties:

Possible values

The CSS property column-rule is specified as one, two, or three of the values and in any order:

  • <'column-rule-color'>: Takes a <color> value.

  • <'column-rule-style'>: Sets the style of the column rule. Refer the border-style for possible values.

  • <'column-rule-width'>: Takes a <length> value or one of the keywords, thin, medium, or thick. Refer the border-width for possible values.

Applies to

All the multicol elements.

Syntax

column-rule = <'column-rule-color'> || <'column-rule-style'> || <'column-rule-width'>

CSS column-rule - Basic Example

In the following example the column-rule shorthand property is used to add a rule with color, style and width values, in the same order as specified:

<html>
<head>
<style> 
   .multicol-col-rule {
      column-count: 3;
      column-gap: 50px;
      column-rule: 5px dashed blue;
   }

   p {
      background-color: bisque;
   }
</style>
</head>
<body>
   <h1>column-rule property</h1>

   <div class="multicol-col-rule">
      <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p>
      <p>Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius.</p>
   </div>
</body>
</html>

CSS column-rule - Order Of Values Changed

In the following example the column-rule shorthand property is used to add a rule with style, width, and color values, in the same order as specified:

<html>
<head>
<style> 
   .multicol-col-rule {
      column-count: 3;
      column-gap: 50px;
      column-rule: inset 10px purple;
   }

   p {
      background-color: pink;
   }
</style>
</head>
<body>
   <h1>column-rule property</h1>

   <div class="multicol-col-rule">
      <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p>
      <p>Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius.</p>
   </div>
</body>
</html>
Advertisements