--- title: border-image-slice slug: Web/CSS/border-image-slice translation_of: Web/CSS/border-image-slice ---
{{CSSRef}}

Описание

CSS свойство border-image-slice  делит изображение указанное в {{cssxref("border-image-source")}} на девять областей: четыре угла, четыре края и середину. Это происходит путём указания 4 внутренних смещений.

The nine slices defined by the CSS border-image shorthand or border-image-slice longhand propertiesЧетыре значения управляют положением линий среза. If some are not specified, they are inferred from the other with the usual 4-value syntax of CSS.

The middle is not used by the border itself but is used as a background-image if the keyword fill is set. The keyword can be set at any position in the property (before, after or between the other values).

The {{cssxref("border-image-repeat")}}, {{cssxref("border-image-width")}}, {{cssxref("border-image-outset")}} properties define how these images will be used.

The shorthand CSS property {{cssxref("border-image")}} may reset this property to its default value.

{{cssinfo}}

Синтаксис

/* border-image-slice: slice */
border-image-slice: 30%;

/* border-image-slice: horizontal vertical */
border-image-slice: 10% 30%;

/* border-image-slice: top horizontal bottom */
border-image-slice: 30 30% 45;

/* border-image-slice: top right bottom left */
border-image-slice: 7 12 14 5;

/* border-image-slice: … fill */
/* The fill value can be placed between any value */
border-image-slice: 10% fill 7 12;

/* Глобальные значения */
border-image-slice: inherit;
border-image-slice: initial;
border-image-slice: unset;

Значения

slice
Is a {{cssxref("<number>")}} or a {{cssxref("<percentage>")}} of the offset for the four slicing lines. Note that a {{cssxref("<length>")}} value is not allowed, and therefore invalid. The {{cssxref("<number>")}} represents pixels for raster images and coordinates for vector images. Also, {{cssxref("<percentage>")}} values are relative to the height or width of the image, whichever is adequate. Negative values are invalid and values greater than the relevant size, height or width, are clamped to 100%.
horizontal
Is a {{cssxref("<number>")}} or a {{cssxref("<percentage>")}} of the offset for the two horizontal slicing lines, the top and the bottom ones. Note that a {{cssxref("<length>")}} value is not allowed, and therefore invalid. The {{cssxref("<number>")}} represents pixels for raster images and coordinates for vector images. Also, {{cssxref("<percentage>")}} values are relative to the height or width of the image, whichever is adequate. Negative values are invalid and values greater than the relevant size, height or width, are clamped to 100%.
vertical
Is a {{cssxref("<number>")}} or a {{cssxref("<percentage>")}} of the offset for the two vertical slicing lines, the right and the left ones. Note that a {{cssxref("<length>")}} value is not allowed, and therefore invalid. The {{cssxref("<number>")}} represents pixels for raster images and coordinates for vector images. Also, {{cssxref("<percentage>")}} values are relative to the height or width of the image, whichever is adequate. Negative values are invalid and values greater than the relevant size, height or width, are clamped to 100%.
top
Is a {{cssxref("<number>")}} or a {{cssxref("<percentage>")}} of the offset for the top slicing line. Note that a {{cssxref("<length>")}} value is not allowed, and therefore invalid. The {{cssxref("<number>")}} represents pixels for raster images and coordinates for vector images. Also, {{cssxref("<percentage>")}} values are relative to the height or width of the image, whichever is adequate. Negative values are invalid and values greater than the relevant size, height or width, are clamped to 100%.
bottom
Is a {{cssxref("<number>")}} or a {{cssxref("<percentage>")}} of the offset for the bottom slicing line. Note that a {{cssxref("<length>")}} value is not allowed, and therefore invalid. The {{cssxref("<number>")}} represents pixels for raster images and coordinates for vector images. Also, {{cssxref("<percentage>")}} values are relative to the height or width of the image, whichever is adequate. Negative values are invalid and values greater than the relevant size, height or width, are clamped to 100%.
right
Is a {{cssxref("<number>")}} or a {{cssxref("<percentage>")}} of the offset for the right slicing line. Note that a {{cssxref("<length>")}} value is not allowed, and therefore invalid. The {{cssxref("<number>")}} represents pixels for raster images and coordinates for vector images. Also, {{cssxref("<percentage>")}} values are relative to the height or width of the image, whichever is adequate. Negative values are invalid and values greater than the relevant size, height or width, are clamped to 100%.
left
Is a {{cssxref("<number>")}} or a {{cssxref("<percentage>")}} of the offset for the left slicing line. Note that a {{cssxref("<length>")}} value is not allowed, and therefore invalid. The {{cssxref("<number>")}} represents pixels for raster images and coordinates for vector images. Also, {{cssxref("<percentage>")}} values are relative to the height or width of the image, whichever is adequate. Negative values are invalid and values greater than the relevant size, height or width, are clamped to 100%.
fill
Is a keyword whose presence forces the use of the middle image slice to be displayed over the background image, its size and height are resized like those of the top and left image slices, respectively.
inherit
Is a keyword indicating that all four values are inherited from their parent's element calculated value.

Формальный синтаксис

{{csssyntax}}

Спецификации

Спецификация Статус Комментарий
{{SpecName('CSS3 Backgrounds', '#border-image-slice', 'border-image-slice')}} {{Spec2('CSS3 Backgrounds')}} Первоначальное определение

Совместимость с браузерами

{{CompatibilityTable}}
Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Базовая поддержка 15.0 {{CompatGeckoDesktop("15.0")}} 11 15 6
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Базовая поддержка 4.1{{property_prefix("-webkit")}} {{CompatGeckoMobile("15.0")}} {{CompatNo}} {{CompatUnknown}} {{CompatUnknown}}