CSS3 border-image
Property
Topic: CSS3 Properties ReferencePrev|Next
Description
The border-image
CSS property specifies how an image is to be used in place of the border styles. This is a shorthand property for setting border-image-source
, border-image-slice
, border-image-width
, border-image-outset
and border-image-repeat
properties at once.
The following table summarizes the usages context and the version history of this property.
Default value: | none 100% 1 0 stretch ; See individual properties |
---|---|
Applies to: | All elements, except internal table elements when border-collapse is collapse . It also applies to ::first-letter . |
Inherited: | No |
Animatable: | No. See animatable properties. |
Version: | New in CSS3 |
Syntax
The syntax of the property is given with:
The example below shows the border-image
property in action.
Example
Try this code ».box {
width: 300px;
height: 150px;
border: 15px solid transparent;
-webkit-border-image: url("border.png") 30 30 round; /* Safari 3.1-5 */
-o-border-image: url("border.png") 30 30 round; /* Opera 11-12.1 */
border-image: url("border.png") 30 30 round;
}
Property Values
The following table describes the values of this property.
Value | Description |
---|---|
border-image-source |
Specifies the location of the image to be used for the border. |
border-image-slice |
Specifies the inward offsets from the top, right, bottom, and left edges of the border image. |
border-image-width |
Specifies the width of the border. |
border-image-outset |
Specifies the amount by which the border image area extends beyond the border box. |
border-image-repeat |
Specifies how the middle part of the border image are scaled or tiled so that it can match the size of the border. |
initial |
Sets this property to its default value. |
inherit |
If specified, the associated element takes the computed value of its parent element border-image property. |
Browser Compatibility
The border-image
property is supported in all major modern browsers.
Basic Support—
|
Further Reading
See tutorial on: CSS3 Border, CSS Border.
Related properties: border-image-source
, border-image-slice
, border-image-width
, border-image-outset
, border-image-repeat
, border
.