English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

CSS reference manual

CSS @rules

CSS attributes大全

CSS3 border-image-Usage and examples of the 'source' attribute

border-image-The source CSS attribute specifies the position of the image to be used for the border, rather thanborder-styleThe border style specified by the attribute.

The following table provides usage instructions and version history of this attribute, as well as its usage syntax in JavaScript scripts.

Default value:none
Applies to:This attribute can be applied to any element, but when the border of the table element (such as tr, th, td) is-When the collapse attribute value of border is collapse,-image-The source attribute is invalid. It also applies to::first-letter.
Inheritance:No
Can be animated:No.See also Animation properties.
Version: CSS3new feature
JavaScript syntax:object.style.borderImageSource="url(border.png)"

border-image-source attribute syntax

The syntax of this attribute is as follows:

border-image-source: none | image | initial | inherit

The following examples demonstrate how to use border-image-source attribute.

.box {
    width: 300px;
    height: 150px;
    border-image-source: url("border.png");
    border-image-slice: 30;
    border-image-repeat: round;
}
Test and see‹/›

Attribute value

The following table describes the values of this attribute.

ValueDescription
noneIf there is no border image, the border style will be used. This is the default value.
imageSpecify the position of the border image.
initialSet this property to its default value.
inheritIf specified, the associated element uses its parent element's border-image-The calculated value of the source attribute.

Browser compatibility

border-image-Browser compatibility of the source attribute, the numbers in the following table indicate the minimum version number of the browser that supports this attribute; all mainstream browsers support this attribute.

  • Firefox 15+

  • Google Chrome15+

  • Internet Explorer 11+

  • Apple Safari 6+

  • Opera 15+

Further reading

Please refer to the following tutorials:CSS3 BorderandCSS Border.

Related properties:border-image,border-image-width,border-image-repeat,border-image-slice,border-image-outset,border.