The border-image-width
CSS property sets the width of an element's border image.
If this property's value is greater than the element's border-width
, the border image will extend beyond the padding (and/or content) edge.
/* Keyword value */ border-image-width: auto; /* <length> value */ border-image-width: 1rem; /* <percentage> value */ border-image-width: 25%; /* <number> value */ border-image-width: 3; /* vertical | horizontal */ border-image-width: 2em 3em; /* top | horizontal | bottom */ border-image-width: 5% 15% 10%; /* top | right | bottom | left */ border-image-width: 5% 2em 10% auto; /* Global values */ border-image-width: inherit; border-image-width: initial; border-image-width: unset;
The border-image-width
property may be specified using one, two, three, or four values chosen from the list of values below.
<length-percentage>
<length>
or a <percentage>
. Percentages are relative to the width of the border image area for horizontal offsets and the height of the border image area for vertical offsets. Must not be negative.<number>
border-width
. Must not be negative.auto
border-image-slice
. If the image does not have the required intrinsic dimension, the corresponding border-width
is used instead.[ <length-percentage> | <number> | auto ]{1,4}where
<length-percentage> = <length> | <percentage>
This example creates a border image using the following ".png" file, which is 90 by 90 pixels:
Thus, each circle in the source image is 30 by 30 pixels.
<p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</p>
p { border: 20px solid; border-image: url("https://mdn.mozillademos.org/files/10470/border.png") 30 round; border-image-width: 16px; padding: 40px; }
Specification | Status | Comment |
---|---|---|
CSS Backgrounds and Borders Module Level 3 The definition of 'border-image-width' in that specification. | Candidate Recommendation | Initial definition |
Initial value | 1 |
---|---|
Applies to | all elements, except internal table elements when border-collapse is collapse . It also applies to ::first-letter . |
Inherited | no |
Percentages | refer to the width or height of the border image area |
Media | visual |
Computed value | as specified, but with relative lengths converted into absolute lengths |
Animation type | discrete |
Canonical order | the unique non-ambiguous order defined by the formal grammar |
Desktop | ||||||
---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
Basic support | 15 | 12 | 13 | 11 | 15 | 6 |
Mobile | |||||||
---|---|---|---|---|---|---|---|
Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
Basic support | ? | ? | Yes | 14 | ? | ? | ? |
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/CSS/border-image-width