CSS3 border-image-slice Property


Example

Specify the inward offsets of the image-border:

div {
    border: 30px solid transparent;
    border-image-source: url(border.png);
    border-image-slice: 15;
}

Try it yourself »

Definition and Usage

The border-image-slice property specifies the inward offsets of the image-border.

Tip: Also look at the border-image property (a shorthand property for setting all the border-image-* properties).

Default value: 100%
Inherited: no
Animatable: no. Read about animatable
Version: CSS3
JavaScript syntax: object.style.borderImageSlice="50% 10%" Try it

Browser Support

The numbers in the table specify the first browser version that fully supports the property.

Property
border-image-slice 15.0 11.0 15.0 6.0 15.0

CSS Syntax

border-image-slice: number|%|fill|initial|inherit;

Note: This property specifies the inward offsets from the top, right, bottom, and left edges of the image, dividing it into nine regions: four corners, four edges and a middle. The middle image part is discarded (treated as fully transparent) unless the fill keyword is present. If the fourth number/percentage is omitted, it is the same as the second. If the third one is also omitted, it is the same as the first. If the second one is also omitted, it is the same as the first.

Property Values

Value Description Play it
number Numbers represent pixels in the image (if the image is a raster image) or vector coordinates (if the image is a vector image) Play it »
% Percentages are relative to the size of the image: the width of the image for the horizontal offsets, the height for vertical offsets. Default value is 100% Play it »
fill Causes the middle part of the border-image to be preserved
initial Sets this property to its default value. Read about initial
inherit Inherits this property from its parent element. Read about inherit

Related Pages

CSS3 tutorial: CSS3 Borders

CSS Reference: border-image property

CSS Reference: border-image-outset property

CSS Reference: border-image-repeat property

CSS Reference: border-image-source property

CSS Reference: border-image-width property

HTML DOM reference: borderImageSlice property



SHARE THIS PAGE

COLOR PICKER

colorpicker





Search w3schools.com:

Translate w3schools.com: