CSS3 Multiple Columns

March 30, 2015
by Inaam Hussain

In CSS3 we can create multiple column for layout text.(Ex: Newspaper Style).

CSS3 Multiple Columns Properties

  • column-count
  • column-gap
  • column-rule

 

Column Count Property

In column-count property we can specifies the number of column of an elements divided into.

Column Count Property

Column Count Property

CSS
div {
    -webkit-column-count: 2; /* For Chrome, Safari, Opera */
    -moz-column-count: 2; /* For Firefox */
    column-count: 2;
}

 

Column Gap Property

In column-gap property we can specifies the gap between the column.

Column Gap Property

Column Gap Property

CSS
div {
    -webkit-column-gap: 35px; /* For Chrome, Safari, Opera */
    -moz-column-gap: 35px; /* For Firefox */
    column-gap: 35px;
}

 

Column Rule Property

In column-rule property we sets the width, style, and color of the rule between columns.

Column Rule Property

Column Rule Property

CSS
div {
    -webkit-column-rule: 4px outset #1FA67A; /* For Chrome, Safari, Opera */
    -moz-column-rule: 4px outset #1FA67A; /* For Firefox */
    column-rule: 4px outset #1FA67A;
}

 

Full HTML & CSS Code

HTML & CSS
<!DOCTYPE html>
<html>
    <head>
        <style>
            .column{
                -webkit-column-count: 3; /* For Chrome, Safari, Opera */
                -moz-column-count: 3; /* For Firefox */
                column-count: 3;
            }
            .columnGap{
             -webkit-column-count: 3; /* For Chrome, Safari, Opera */
                -moz-column-count: 3; /* For Firefox */
                column-count: 3;
                -webkit-column-gap: 60px; /* For Chrome, Safari, Opera */
                -moz-column-gap: 60px; /* For Firefox */
                column-gap: 60px;
            }
            .columnRule {
                -webkit-column-count: 3; /* For Chrome, Safari, Opera */
                -moz-column-count: 3; /* For Firefox */
                column-count: 3;
                -webkit-column-gap: 40px; /* For Chrome, Safari, Opera */
                -moz-column-gap: 40px; /* For Firefox */
                column-gap: 40px;
                -webkit-column-rule: 4px outset #1FA67A; /* For Chrome, Safari, Opera */
                -moz-column-rule: 4px outset #1FA67A; /* For Firefox */
                column-rule: 4px outset #1FA67A;
            }
        </style>
    </head>
    <body>
        <div class="column">
        Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. 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.
        </div>
        <div class="columnGap">
        Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. 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.
        </div>
        <div class="columnRule">
        Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. 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.
        </div>
        <p><b>Note:</b> Internet Explorer 9, and earlier versions, does not support the column property.</p>
    </body>
</html>

 

About

Engineer. Blogger. I like to be updated on new upcoming emerging technologies.

Free PDF

Subscribe and get AngularJS Tips PDF. We never spam!
First Name:
Email:

Leave a Comment