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

MozColumnWidth style property | webkitColumnWidth style property

Browser support:
Specifies or retrieves the suggested width of columns. The width of a column may be different from this value depending on its contents.


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

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.
width in non-negative length
The width of the column in length units. For the supported length units, see the length page.
Default: auto.

Example HTML code 1:

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

Example HTML code 2:

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

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

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

            if ('MozColumnWidth' in {
       = columnWidth;
            } else if ('webkitColumnWidth' in {
       = columnWidth;
            } 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="ChangeColumnWidth (this);" size="6">
        <option selected="selected" />auto
        <option />5em
        <option />10em
        <option />15em
        <option />20em
        <option />30em
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content