You are here: Reference > JavaScript > client-side > style handling > properties > browser specific extensions > MozColumnWidth
MozColumnWidth style property | webkitColumnWidth style property
MozColumnWidth | ||||||
webkitColumnWidth |
Specifies or retrieves the suggested width of columns. The width of a column may be different from this value depending on its contents.
Syntax:
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. | |||||||
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:
|
||||
<head> <style> .example { -moz-column-count: 2; -webkit-column-count: 2; -moz-column-width: 100px; -webkit-column-width: 100px; } </style> </head> <body> <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. </div> </body> |
||||
|
||||
Did you find this example helpful?
|
Example HTML code 2:
This example illustrates the use of the MozColumnWidth and webkitColumnWidth properties in JavaScript:
|
||||
<head> <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 div.style) { div.style.MozColumnWidth = columnWidth; } else if ('webkitColumnWidth' in div.style) { div.style.webkitColumnWidth = columnWidth; } else { alert ("Your browser doesn't support this example!"); } } </script> </head> <body> <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. </div> <select onchange="ChangeColumnWidth (this);" size="6"> <option selected="selected" />auto <option />5em <option />10em <option />15em <option />20em <option />30em </select> </body> |
||||
|
||||
Did you find this example helpful?
|
Supported by objects:
CSSStyleDeclaration, htmlElement.style
HTML elements:
a, abbr, acronym, address, b, bdo, big, blink, blockquote, body, caption, center, cite, code, dd, del, dfn, dir, div, dl, dt, em, fieldset, font, form, h1, h2, h3, h4, h5, h6, html, i, ins, isindex, kbd, label, legend, li, marquee, menu, ol, p, pre, q, s, samp, small, span, strike, strong, sub, sup, table, td, textarea, th, tt, u, ul, var, xmp
Related pages:
External links:
User Contributed Comments