Border-image-repeat - CSS Property

border-image-repeat

Summary of characteristics of the border-image-repeat property

Quick description
Defines how the border image is repeated or expanded to cover the desired area.
Status
Standard
Predefined values
stretch | repeat | round | space
Percentages
Not applicable.
Initial value
stretch
Inherited by default
No.
Discrète: during an animation, the border-image-repeat property passes from one value to another without transition.
Per grammar: serialization in the order of syntax.
W3C Module
CSS Backgrounds and Borders Module
Document status: CR (Candidate Recommendation)

Syntax diagram of border-image-repeat.

border-image-repeat - Syntax DiagramSyntax diagram of the border-image-repeat CSS property, which defines how the border image is repeated or stretched to cover the desired area. stretch stretch repeat repeat round round space space {1,2} {1,2}border-image-repeat:;border-image-repeat:;
Syntax diagram of the border-image-repeat property.
The links in the diagram provide more details about the values.
Download the diagram in SVG.

Description of the border-image-repeat property.

The border-image-repeat property defines how the border image is repeated or stretched to cover the entire border of the element.

If only one value is specified, it applies to all four borders. If two values are specified, the first one applies to the top and bottom borders; the second value applies to the left and right borders.

Other properties related to image borders.

Shorthand of border properties made with image.
Sets the path and file name for the image used to build the border.
Defines how the border image is clipped.
Sets the thickness of the border when the border is made with an image.
Sets the overflow of the border image.

Values for border-image-repeat.

In all the examples below, the image used to create the border is the following:

Image utilisée pour la bordure

  • border-image-repeat: stretch;

    Default value. The image is enlarged to cover the entire border area.

  • border-image-repeat: repeat;

    The image is repeated to cover the length of the border on each side. The first and last images may be cropped.

  • border-image-repeat: round;

    The image is repeated until it covers the length of the border, but without chopping off the images at the ends. The image can be resized to cover the exact length.

  • border-image-repeat: space;

    The image is repeated until it covers the length of the border but without cutting off the images at the ends. Spaces can be added between the images to cover the exact length.

  • border-image-repeat: repeat stretch;

    When two values are specified, separated by a space, they are interpreted as follows:

    • The first value applies to the top and bottom borders, and to the horizontal stretching of the middle part.
    • The second value applies to the right and left borders, and to the vertical expansion of the central part.

    The two examples below are made with the same border image, but the first one is stretched vertically (value stretch) while the second one is stretched horizontally.

    border-image-repeat:round stretch
    border-image-repeat:stretch round
  • border-image-repeat: initial; (stretch) border-image-repeat: inherit; border-image-repeat: revert; border-image-repeat: revert-layer; border-image-repeat: revert-rule; border-image-repeat: unset;

    See the following pages for more details: initial, inherit, revert, revert-layer, revert-rule, unset.

Animation of the border-image-repeat property.

The property border-image-repeat doesn't handle numeric values, so its animation jumps from one value to another. The result looks like a store's neon sign.

Access the border-image-repeat property via a program

Changer la répétition de l'image de bordure avec Javascript.

JavaScript accepts two syntaxes for writing the property name:

  • With the typical CSS notation: a dash to separate words (kebab-case).
  • With the more common notation in JavaScript: a capital letter to separate words (camel-case).
Javascript
let el = document.getElementById('id'); el.style['border-image-repeat'] = 'round'; // or let el = document.getElementById('id'); el.style.borderImageRepeat = 'round';

Read the border image repeat with JavaScript.

The code below retrieves the value of the property if it has been applied directly to the element via the HTML style attribute, and not through a CSS selector.

Javascript
let el = document.getElementById('id'); el.style['border-image-repeat'] = 'round'; // or let el = document.getElementById('id'); el.style.borderImageRepeat = 'round';

With Javascript, read the computed value of border-image-repeat.

The computed value comes from evaluating the priority rules and any inheritances (see Priorities). If not, the computed value is the initial value of the property (stretch in the case of border-image-repeat).

Javascript
let el = document.getElementById('id'); let value = window.getComputedStyle(el).getPropertyValue('border-image-repeat');

With JQuery, read or change the value of border-image-repeat.

The property name can be written either in kebab-case or in camel-case.

JQuery

// Read the value:
$('#id').prop('border-image-repeat');
// Write the value:
$('#id').prop('border-image-repeat', 'round');
$('#id').prop('{border-image-repeat': 'round'});

With JQuery, read the computed value of border-image-repeat.

JQuery
let value = $('#id').css('border-image-repeat');

Other examples.

You can find more examples of Javascript and JQuery code on the page Javascript and CSS.

Test it yourself.

Use the buttons below to see how the property border-image-repeat is stored (serialized). For this property, the assigned value and the computed value will be the same, except if an incorrect value is entered. In that case, the assigned value is empty, while the computed value is the initial value of the property (stretch).

Simulator.

border-image-repeat :

Browsers compatibility with border-image-repeat.

The property border-image-repeat, as well as all properties related to border images, are properly supported by browsers.

Column 1
Possibility to use images to create borders and, therefore, support for the border-image property.
Column 2
Support of the property border-image-repeat.
Column 3
Support for the value round for the property border-image-repeat.
Column 4
Support for the value space for the property border-image-repeat.

Notes:

(1) Supports the summary property but not detailed properties.
Doesn't support the space and round values

1
Using images
for borders
2
border-image-repeat
property
3
round
value
4
space
value
Estimated overall support.
97%
96%
96%
96%

Browsers on computers :

Mobile browsers :

Outdated or marginal browsers :

Internet Explorer

KaiOS Browser

Opéra Mobile

Chrome

Edge

Opéra

Safari

Safari sur IOS

Androïd Brower

Chrome pour Androïd

Firefox pour Androïd

Samsung Internet

Firefox

Baidu Browser

QQ Browser

UC Browser pour Androïd

Opéra mini

Historic of the border-image-repeat property.

  • CSS Backgrounds and Borders Module Level 3

    Level 3 of the specification also explains how to position the background relative to the background area, and how to crop it.
    Regarding borders, the concept of image borders is introduced, as well as the ideas of rounded corners and box shadows.

    Regarding border-image-repeat Introduction of the border-image-repeat property and more generally borders created with an image.
    WD
    August 02, 2002
    Working Draft.
    CR
    December 17, 2009
    Candidate Recommendation.
    PR
    REC

See also: other border and background features.

The properties related to borders and backgrounds are described in the CSS Backgrounds and Borders Module specification of the W3C. Here is the list:

Properties:

background
Summary of background properties.
background-attachment
Background image scrolling mode.
background-clip
Defines the extent of the background, especially in relation to the border and padding.
background-color
Sets the background color.
background-image
Defines the background image or gradient (multiple images or gradients can coexist).
background-origin
Defines a reference to position the background image.
background-position
Defines how the background image is positioned.
background-position-block
Sets the background positioning in the block direction.
background-position-inline
Sets the background positioning along the lines.
background-position-x
Sets how the background image is positioned horizontally.
background-position-y
Defines how the background image is positioned in the vertical direction.
background-repeat
Defines how the background image is repeated.
background-size
Sizing the background image.
border
A shorthand property that defines the set of border parameters: width, style and color.
border-bottom
Sets the parameters of the bottom border of the element (thickness, line style, color).
border-bottom-color
Sets the border line color for the bottom of the element.
border-bottom-left-radius
Sets the radius of the rounded corner at the bottom left.
border-bottom-right-radius
Sets the radius of the rounded corner in the lower right.
border-bottom-style
Sets the line style for the border below the element.
border-bottom-width
Sets the thickness of the border line located below the element.
border-color
Sets the border color for all four sides of the element.
border-end-end-radius
Sets the radius of the corner rounding at the end of line and end of block.
border-end-start-radius
Sets the radius of the corner rounding at the end of line and beginning of the block.
border-image
Shorthand of border properties made with image.
border-image-outset
Sets the overflow of the border image.
Border-image-repeat
Defines how the border image is repeated or expanded to cover the desired area.
border-image-slice
Defines how the border image is clipped.
border-image-source
Sets the path and file name for the image used to build the border.
border-image-width
Sets the thickness of the border when the border is made with an image.
border-left
Sets the three parameters of the left border of the element (thickness, line style, color).
border-left-color
Sets the color of the left border line of the element.
border-left-style
Sets the border style for the left side of the element.
border-left-width
Sets the thickness of the border on the left side of the element.
border-radius
Radius of rounded corners.
border-right
Sets the three parameters of the right border of the element (thickness, line style, color).
border-right-color
Sets the color of the border line on the right side of the element.
border-right-style
Sets the line style for the right border of the element.
border-right-width
Sets the thickness of the border on the right side of the element.
border-start-end-radius
Sets the radius of the corner rounding at the beginning of the line and the end of the block.
border-start-start-radius
Sets the radius of the corner rounding at the beginning of the line and the beginning of the block.
border-style
Sets the line type for some or all four borders around the element (solid, double, dotted...).
border-top
Sets the parameters of the top border of the element (thickness, line style, color).
border-top-color
Sets the color of the border line above the element.
border-top-left-radius
Sets the radius of the rounded corner at the top left.
border-top-right-radius
Sets the radius of the rounded corner in the upper-right.
border-top-style
Sets the line style for the left border of the element.
border-top-width
Sets the thickness of the border line above the element.
border-width
Sets the thickness of the border line around the element.
box-shadow
Applies a shading effect to the frames by indicating all the parameters: color, shadow shift, blur, etc.