CSS3 border-image-slice
Property
Topic: CSS3 Properties ReferencePrev|Next
Description
The border-image-slice
CSS property divides the image specified by border-image-source
in nine regions: four corners, four edges, and a middle. It does this by specifying 4 inwards offsets that typically creates a three by three grid.
The middle part of the border image is discarded and not used by the border itself but is used as a background-image
if the fill
keyword is present.
The following table summarizes the usages context and the version history of this property.
Default value: | 100% |
---|---|
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-slice
property in action.
Example
Try this code ».box {
width: 300px;
height: 150px;
border: 15px solid transparent;
border-image-source: url("border.png");
border-image-slice: 30;
border-image-repeat: round;
}
Property Values
The following table describes the values of this property.
Value | Description |
---|---|
number | Represents distance in pixels of the image for raster images, or vector coordinates for vector images. |
percentage | Relative to the size of the image: the width of the image for horizontal offsets, the height of the image for vertical offsets. |
fill |
If present, preserves the middle portion of the image. Otherwise, the middle is treated as transparent. |
initial |
Sets this property to its default value. |
inherit |
If specified, the associated element takes the computed value of its parent element border-image-slice property. |
Browser Compatibility
The border-image-slice
property is supported in all major modern browsers.
Basic Support—
|
Further Reading
See tutorial on: CSS3 Border, CSS Border.
Related properties: border-image
, border-image-source
, border-image-repeat
, border-image-width
, border-image-outset
, border
.