You are here: Reference > JavaScript > client-side > style handling > properties > browser specific extensions > MozBoxAlign
MozBoxAlign style property | webkitBoxAlign style property
MozBoxAlign | ||||||
webkitBoxAlign |
Specifies or retrieves how child elements of the box are aligned, when the size of the box is larger than the total 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.
MozBoxAlign: | This property is read/write. |
webkitBoxAlign: | This property is read/write. |
CSS page for this property: -moz-box-align |
Possible values:
The type of this property is string.
One of the following values:
This value only applies to horizontally oriented boxes. | |||||||
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 aligned starting from the left or top edge of the box. | |||||||
The child elements are stretched to fit the size of the box. |
Default: stretch.
Example HTML code 1:
This example illustrates the use of the -moz-box-align and the -webkit-box-align properties:
|
||||
<head> <style> .alignStart { height: 50px; border: 5px solid red; display: -moz-inline-box; display: -webkit-inline-box; -moz-box-align: start; -webkit-box-align: start; } .alignEnd { height: 50px; border: 5px solid red; display: -moz-inline-box; display: -webkit-inline-box; -moz-box-align: end; -webkit-box-align: end; } </style> </head> <body> <div class="alignStart"> box-align: start </div> <div class="alignEnd"> box-align: end </div> </body> |
||||
|
||||
Did you find this example helpful?
|
Example HTML code 2:
This example illustrates the use of the MozBoxAlign and webkitBoxAlign properties in JavaScript:
|
||||
<head> <style> .example { display: -moz-inline-box; width: 250px; height: 100px; border: 5px solid red; -moz-box-align: baseline; } </style> <script type="text/javascript"> function ChangeBoxAlign (selectTag) { // Returns the index of the selected option var whichSelected = selectTag.selectedIndex; // Returns the selected option's text var boxAlign = selectTag.options[whichSelected].text; var div = document.getElementById ("myDiv"); if ('MozBoxAlign' in div.style) { div.style.MozBoxAlign = boxAlign; } else if ('webkitBoxAlign' in div.style) { div.style.webkitBoxAlign = boxAlign; // solve refresh problems div.className = ""; div.focus (); div.className = "example"; } else { alert ("Your browser doesn't support this example!"); } } </script> </head> <body> <div class="example" id="myDiv"> <b>first elem </b> <i>second elem</i> </div> <select onchange="ChangeBoxAlign (this);" size="6"> <option selected="selected" />baseline <option />center <option />end <option />inherit <option />start <option />stretch </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