You are here: Reference > JavaScript > client-side > style handling > properties > browser specific extensions > MozBoxPack
MozBoxPack style property | webkitBoxPack style property
MozBoxPack | ||||||
webkitBoxPack |
Specifies or retrieves where child elements of the box are placed when the box is larger than the size of the children.
Only works for box objects. An element is a box object if the display property of the element has the value of
-moz-box (-webkit-box) or -moz-inline-box (-webkit-inline-box).
Syntax:
You can find the related objects in the Supported by objects section below.
MozBoxPack: | This property is read/write. |
webkitBoxPack: | This property is read/write. |
CSS page for this property: -moz-box-pack |
Possible values:
The type of this property is string.

Extra space is split equally along each side of the child elements, resulting in the children being placed in the center of the box. | |||||||
Child elements are placed on the right or bottom edge of the box. | |||||||
Takes the value of this property from the computed style of the parent element. | |||||||
Child elements are justified. | |||||||
Child elements are placed starting from the left or top edge of the box. |
Default: start.
Example HTML code 1:
This example illustrates the use of the -moz-box-pack and the -webkit-box-pack properties:
|
||||
<head> <style> .packStart { border: 2px solid red; width: 250px; display: -moz-inline-box; display: -webkit-inline-box; -moz-box-pack: start; -webkit-box-pack: start; } .packEnd { border: 2px solid red; width: 250px; display: -moz-inline-box; display: -webkit-inline-box; -moz-box-pack: end; -webkit-box-pack: end; } .packCenter { border: 2px solid red; width: 250px; display: -moz-inline-box; display: -webkit-inline-box; -moz-box-pack: center; -webkit-box-pack: center; } </style> </head> <body> <div class="packStart" > box-pack: start. </div> <div class="packEnd" > box-pack: end. </div> <div class="packCenter" > box-pack: center. </div> </body> |
||||
|
||||
Did you find this example helpful?
|
Example HTML code 2:
This example illustrates the use of the MozBoxPack property in JavaScript:
|
||||
<head> <style> .example { border: 2px solid red; width: 250px; display: -moz-inline-box; -moz-box-pack: start; } </style> <script type="text/javascript"> function ChangeBoxPack (selectTag) { // Returns the index of the selected option var whichSelected = selectTag.selectedIndex; // Returns the selected option's text var boxPack = selectTag.options[whichSelected].text; //Changes the value of the property var div = document.getElementById ("myDiv"); div.style.MozBoxPack = boxPack; // solve refresh problems div.className = ""; div.focus (); div.className = "example"; } </script> </head> <body> <div class="example" id="myDiv"> test -moz-box-pack property. </div> <select onchange="ChangeBoxPack (this);" size="5"> <option selected="selected" />start <option />center <option />end <option />inherit <option />justify </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, hr, html, i, iframe, ins, isindex, kbd, label, legend, li, marquee, menu, ol, p, pre, q, s, samp, small, span, strike, strong, sub, sup, table, td, textarea, th, tr, tt, u, ul, var, xmp
Related pages:
External links:
User Contributed Comments