CSS PROPERTIES
Expand All|Collapse All
CSS AT-RULES
SPONSORED LINKS

CSS3 border-image-slice Property

Topic: CSS3 Properties Reference« Prev|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:

border-image-slice: 
[ number | percentage ] 1 to 4 values | fill | initial | inherit

The example below shows the border-image-slice property in action.

  • .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.

Browsers Icon

Basic Support—

  • Firefox 15+
  • Google Chrome 15+
  • Internet Explorer 11+
  • Apple Safari 6+
  • Opera 15+

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.

 
Close

Your Feedback:

 

We would love to hear from you! Please say something.