You are here: Reference > JavaScript > client-side > style handling > properties > browser specific extensions > MozBorderImage
MozBorderImage style property | webkitBorderImage style property
MozBorderImage |
|
||||||||||
webkitBorderImage |
Specifies or retrieves an image to use as the border of the element. The image is sliced into 9 pieces along the four diagonals specified with the length units.
This property works for all elements, except table cell elements if the borderCollapse property of the container table is set to collapse.
Note: The MozBorderImage property is supported in Firefox from version 3.5.
Syntax:
You can find the related objects in the Supported by objects section below.
MozBorderImage: | This property is read/write. |
webkitBorderImage: | This property is read/write. |
CSS page for this property: -moz-border-image |
Possible values:
The type of this property is string.
One of the following values: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Description of values:
Separate the cutter edge values from the border-width values. | |||||||
Where URI specifies the location of the image file. | |||||||
The width of the border in length units. For the supported length units, see the length page. | |||||||
Takes the value of this property from the computed style of the parent element. | |||||||
Default. | |||||||
Default. No border image is used. | |||||||
Images are repeated to fit the size of the box. | |||||||
Repeat and stretch, partial images are not allowed. | |||||||
Specifies a part of the actual image (fit to the element) in pixels to use for the border. | |||||||
Specifies a part of the image in length units to use for the border. For the supported length units, see the length page. | |||||||
The size is the specified percentage of the size of the image. | |||||||
Images are stretched to fit the size of the box. | |||||||
Greater than the medium width. | |||||||
Less than the medium width. |
Default: none.
The image specified by the URI is cut into 9 pieces by 4 cutter edges (2 horizontal, 2 vertical).
The size values determine the position of the cutter edges from the top, right, bottom and left side of the image.
The border-width values decide the width of the element's border. The border separator lines (lines between the contents of the element and the borders) cut the element into 9 pieces.
The 9 pieces of the image will be fit into the 9 pieces of the element.
You can specify the behavior of the fitting by the repeat style parameters. If only one repeat style value is specified, it affects the horizontal and vertical directions, too. If no repeat style value is defined, the default is 'stretch stretch'.
|
Example HTML code 1:
This example illustrates the use of the -moz-border-image and -webkit-border-image properties:
|
||||
<head> <style> #myDiv { padding: 32px; border-width: 27px; -moz-border-image: url("border.png") 27 27 27 27 round round; -webkit-border-image: url("border.png") 27 27 27 27 round round; } </style> </head> <body> <br /><br /><br /> <span id="myDiv"> border-image-test </span> </body> |
||||
|
||||
Did you find this example helpful?
|
Example HTML code 2:
This example illustrates the use of the MozBorderImage and WebkitBorderImage properties in JavaScript:
|
||||
<head> <style> #myDiv { padding: 32px; border-width: 27px; -moz-border-image: url("border.png") 27 27 27 27 round round; -webkit-border-image: url("border.png") 27 27 27 27 round round; } </style> <script type="text/javascript"> function ChangeRepeatStyle () { var div = document.getElementById ("myDiv"); if ('MozBorderImage' in div.style) { div.style.MozBorderImage = "url('border.png') 27 27 27 27 stretch stretch"; } else if ('webkitBorderImage' in div.style) { div.style.webkitBorderImage = "url('border.png') 27 27 27 27 stretch stretch"; } else { alert ("Your browser doesn't support this example!"); } } </script> </head> <body> <br /><br /><br /> <span id="myDiv"> border-image-test </span> <br /><br /><br /><br /><br /> <button onclick="ChangeRepeatStyle ()"> Change the repeat style of the border image </button> </body> |
||||
|
||||
Did you find this example helpful?
|
Supported by objects:
CSSStyleDeclaration, htmlElement.style
HTML elements:
a, abbr, acronym, address, applet, b, bdo, big, blink, blockquote, body, button, caption, center, cite, code, dd, del, dfn, dir, div, dl, dt, em, embed, fieldset, font, form, h1, h2, h3, h4, h5, h6, hr, html, i, iframe, img, input:button, input:checkbox, input:file, input:image, input:password, input:radio, input:range, input:reset, input:search, input:submit, input:text, ins, isindex, kbd, label, legend, li, marquee, menu, object, ol, p, pre, q, s, samp, select, small, span, strike, strong, sub, sup, table, tbody, td, textarea, tfoot, th, thead, tt, u, ul, var, xmp
Related pages:
MozBorderRadiusBottomleft
MozBorderRadiusBottomright
webkitBorderHorizontalSpacing
MozBorderRadius
MozBorderRadiusTopleft
MozBorderRadiusTopright
webkitBorderVerticalSpacing
MozBorderRadiusBottomright
webkitBorderHorizontalSpacing
MozBorderRadius
MozBorderRadiusTopleft
MozBorderRadiusTopright
webkitBorderVerticalSpacing
External links:
-moz-border-image (Mozilla Developer Center)
-webkit-border-image (Safari Reference Library)
CSS3 Advanced Layout
-webkit-border-image (Safari Reference Library)
CSS3 Advanced Layout
User Contributed Comments