You are here: Reference > JavaScript > client-side > style handling > properties > browser specific extensions > MozColumnCount
MozColumnCount style property | webkitColumnCount style property
MozColumnCount | ||||||
webkitColumnCount |
Specifies or retrieves the number of columns that the contents of the element should be flowed into.
Syntax:
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. | |||||||
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:
|
||||
<head> <style> .example { -moz-column-count: 2; -webkit-column-count: 2; } </style> </head> <body> <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! </div> </body> |
||||
|
||||
Did you find this example helpful?
|
Example HTML code 2:
This example illustrates the use of the MozColumnCount and webkitColumnCount properties in JavaScript:
|
||||
<head> <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 div.style) { div.style.MozColumnCount = columnCount; } else if ('webkitColumnCount' in div.style) { div.style.webkitColumnCount = columnCount; } 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="ChangeColumnCount (this);" size="6"> <option selected="selected" />auto <option />2 <option />4 <option />6 <option />7 <option />14 </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