You are here: Reference > JavaScript > client-side > style handling > properties > browser specific extensions > MozColumnCount

MozColumnCount style property | webkitColumnCount style property

Browser support:
Specifies or retrieves the number of columns that the contents of the element should be flowed into.


You can find the related objects in the Supported by objects section below.
MozColumnCount: This property is read/write.
webkitColumnCount: This property is read/write.
CSS page for this property: -moz-column-count

Possible values:

The type of this property is string.
 One of the following values: 
The browser renders the contents automatically.
Takes the value of this property from the computed style of the parent element.
number of columns (positive integer)
Integer, the number of columns.
Default: auto.

Example HTML code 1:

This example illustrates the use of the -moz-column-count and the -webkit-column-count properties:
        .example {
            -moz-column-count: 2;
            -webkit-column-count: 2;
    <div class="example">
        You can order the text content of an element into one or more columns with the 
        -moz-column-count and the -webkit-column-count properties.
        Resize the window!
Did you find this example helpful? yes no

Example HTML code 2:

This example illustrates the use of the MozColumnCount and webkitColumnCount properties in JavaScript:
    <script type="text/javascript">
        function ChangeColumnCount (selectTag) {
            // Returns the index of the selected option
            var whichSelected = selectTag.selectedIndex;

            // Returns the text of the selected option
            var columnCount = selectTag.options[whichSelected].text;

            var div = document.getElementById ("myDiv");

            if ('MozColumnCount' in {
       = columnCount;
            } else if ('webkitColumnCount' in {
       = columnCount;
            } else {
                alert ("Your browser doesn't support this example!");
    <div id="myDiv">
        Lorem ipsum dolor sit amet, consectetuer adipiscing elit. 
        Sed libero purus, nonummy et, viverra a, vestibulum eu, mauris. 
        Quisque consectetuer venenatis elit. Etiam lorem lectus, 
        lobortis malesuada, elementum quis, consequat at, eros. 
        Ut scelerisque faucibus velit.

    <select onchange="ChangeColumnCount (this);" size="6">
        <option selected="selected" />auto
        <option />2
        <option />4
        <option />6
        <option />7
        <option />14
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content