Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

CSS3 border-image property

CSS3 border-image property

Example

Specify an image to be used as the border around a div element:

#borderimg

{

webkit-border-image:

url

(

border

.

png

)

30

round

;

/*

Safari 3.1-5

*/

o-border-image:

url

(

border

.

png

)

30

round

;

/*

Opera 11-12.1

*/

border-image:

url

(

border

.

png

)

30

round

;

}

Try it »

There are more examples at the bottom of this page.


Browser support

The numbers in the table indicate the first browser version that supports this property.

A number immediately before -webkit-, -ms-, or -moz- indicates the first browser version that supports that prefixed property.

property
border-image 16.0
4.0 -webkit- 11.0 15.0
3.5 -moz- 6.0
3.1 -webkit- 15.0
11.0 -o-

Property definition and usage

The border-image property is a shorthand property used to set border-image-source, border-image-slice, border-image-width, border-image-outset andborder-image-repeat value.

Omitted values are set to their default values.

Tip: Use the border-image-* properties to build beautiful scalable buttons!

Default value: none 100% 1 0 stretch
Inherited: no
Version: CSS3
JavaScript syntax: object.style.borderImage="url(border.png) 30 30 round"

Syntax


border-image: source slice width outset repeat|initial|inherit;
Value Description
border-image-source Used to specify the path of the image to be used for drawing the border
border-image-slice Inward offset of the image border
border-image-width Width of the image border
border-image-outset Used to specify the amount by which the border-image-area is drawn outside the border
border-image-repeat Used to set whether the image border should be repeated, stretched, or rounded.

More examples

Image button
This example demonstrates how to create a button using the border-image property.


Related Articles

CSS3 tutorial: CSS3 Borders