border-image-width
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since February 2017.
Описание
he border-image-width
CSS property defines the width of the border image by defining inward offsets from the border edges. If the border-image-width
is greater than the border-width
, then the border image extends beyond the padding (and/or content) edge.
Начальное значение | 1 |
---|---|
Применяется к | все элементы, кроме внутренних табличных элементов, когда border-collapse :collapse . Это также применяется к ::first-letter . |
Наследуется | нет |
Проценты | относятся к высоте или ширине области рамки картинки |
Обработка значения | как указано, но с относительной длиной, конвертируемой в абсолютные длины |
Animation type | by computed value type |
Синтаксис
/* border-image-width: all */
border-image-width: 3;
/* border-image-width: vertical horizontal */
border-image-width: 2em 3em;
/* border-image-width: top horizontal bottom */
border-image-width: 5% 15% 10%;
/* border-image-width: 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;
где:
- width
-
Is a value denoting the width of the image used as a border to apply to all four edges. It is used only in the one-value syntax.
- vertical
-
Is a value denoting the width of the image used as a border to apply to all vertical edges, that is the top and bottom edges. It is used only in the two-value syntax.
- horizontal
-
Is a value denoting the width of the image used as a border to apply to all horizontal edges, that is the right and left edges. It is used only in the two- and three-value syntaxes.
- top
-
Is a value denoting the width of the image used as a border to apply to the top edge. It is used only in the three- and four-value syntaxes.
- bottom
-
Is a value denoting the width of the image used as a border to apply to the bottom edge. It is used only in the three- and four-value syntaxes.
- right
-
Is a value denoting the width of the image used as a border to apply to the right edge. It is used only in the four-value syntax.
- left
-
Is a value denoting the width of the image used as a border to apply to the left edge. It is used only in the four-value syntax.
inherit
-
Is a keyword indicating that all four values are inherited from their parent's element calculated value.
Значения
<length>
-
Represents the width of the border. It can be an absolute or relative length. This length must not be negative.
<percentage>
-
Represents the width of the border as a percentage of the element. The percentage must not be negative.
<number>
-
Represents a multiple of the computed value of the element's
border-width
property to be used as the border width. The number must not be negative. auto
-
Causes the border image width to equal the intrinsic width or height (whichever is applicable) of the corresponding
border-image-slice
. If the image does not have the required intrinsic dimension then the corresponding computed border-width is used instead.
Формальный синтаксис
border-image-width =
[ <length-percentage [0,∞]> | <number [0,∞]> | auto ]{1,4}
<length-percentage> =
<length> |
<percentage>
Примеры
HTML Content
<!doctype html>
<html>
<head></head>
<body>
<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>
</body>
</html>
CSS Content
p {
border-image-source: url("border.png");
border-image-slice: 30;
border-image-width: 20px;
border-image-repeat: round;
padding: 40px;
}
Спецификации
Specification |
---|
CSS Backgrounds and Borders Module Level 3 # the-border-image-width |
Совместимость с браузерами
BCD tables only load in the browser