Border-image-outset - CSS Property

border-image-outset

Summary of characteristics of the border-image-outset property

Quick description
Sets the overflow of the border image.
Status
Standard
Predefined values
0
Percentages
Not applicable.
Initial value
0
Inherited by default
No.
Computed value: during an animation, the border-image-outset property gradually changes from one value to another.
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-outset.

border-image-outset - Syntax DiagramSyntax diagram of the border-image-outset CSS property, which defines the overflow of the border image. length length number number {1,4} {1,4}border-image-outset:;border-image-outset:;
Syntax diagram of the border-image-outset property.
The links in the diagram provide more details about the values.
Download the diagram in SVG.

In the diagram, the bold terms are the predefined words of CSS, the other terms are described below:

  • length is a positive or zero number followed by one of CSS dimension units.
  • number is a positive number without a unit.
  • These syntaxes can be repeated from 1 to 4 times.

Description of the border-image-outset property.

border-image-outset sets an offset of the image-border outward from the element. It accepts one to four values:

  • If only one value is given, it applies to all four sides.
  • If two values are specified, the first one sets the overflow for the top and bottom borders; the second one for the left and right borders.
  • If three values are given, the first sets the overflow for the top border, the second for the left and right sides, and the last one for the bottom border.
  • Finally, when the four values are given, they correspond respectively to the overflow on the top, right, bottom, and left sides.

In the example below, the image border has been shifted 20 pixels outward from the element. The background color highlights the edges of the element.

Warning! Shifting the border doesn't change the element's dimensions, and therefore doesn't cause a shift in the elements that follow. So the image border could end up colliding with other elements.

On the other hand, and for the same reason that the element is not enlarged, mouse events that occur on the border, outside the element's normal surface, will not be handled. If the border is heavily offset, this can be confusing for the user. By moving the mouse over the example below, you can see the cursor change shape. This indicates the area that is clickable. You can see that it doesn't extend all the way to the border.
 

 


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.
Defines how the border image is repeated or expanded to cover the desired area.

Values for border-image-outset.

  • border-image-outset: 10px;

    A positive or zero value, with its unit of dimension (see CSS dimension units). The default value is 0 without unit. The border image will be offset by the indicated value, outward from the element.

    Negative values are not allowed, so you can't make the border go inside the element.

  • border-image-outset: 2;

    A positive or zero value, without units. This value is a multiple of the border width (border-width).

  • border-image-outset: 2 10 15;

    From one to four values can follow each other, separated by spaces.

    • If only one value is present, it applies to all sides of the element.
    • If two values are present, the first applies to the top and bottom sides, the second to the left and right sides.
    • If three values are set, the first applies to the top side, the second to the left and right sides, and the third to the bottom side.
    • Finally, if four values are set, they apply in order to the top, right, bottom, and left sides.

    In this syntax, it's possible to mix values with units and values without units.

    Syntax with a single value Syntax with two values Syntax with three values Syntax with four values
  • border-image-outset: initial; (0) border-image-outset: inherit; border-image-outset: revert; border-image-outset: revert-layer; border-image-outset: revert-rule; border-image-outset: unset;

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

Animation of the border-image-outset property.

The property border-image-outset can be animated to give a 'breathing' effect, without affecting the other elements on the page.

Watch out! There's a little trap in writing the @keyframes directive. Since border-image-outset accepts numbers both with and without units, you need to make sure that the from and to clauses are expressed in the same unit. This is especially tricky with the value 0, which normally can be written without a unit without any problem. But here, the following code won't produce a smooth animation from 0 to 20 pixels.

@keyframes xxx { from {border-image-outset:0;} /* erreur */ to {border-image-outset:20px;} }

Access the border-image-outset property via a program

With Javascript, change the value of border-image-outset.

In JavaScript, it's possible to change the value of border-image-outset using two syntaxes. The first one uses the typical CSS notation, in kebab-case, and another syntax uses a camel-case notation, which is more common in JavaScript.

Javascript
let el = document.getElementById('id'); el.style['border-image-outset'] = '10px'; // or let el = document.getElementById('id'); el.style.borderImageOutset = '10px';

With Javascript, read the value of border-image-outset.

This code works when the property has been applied directly to the element itself via its style attribute, and not through a CSS selector.

Javascript
let el = document.getElementById('id'); let value = el.style['border-image-outset']; // or let el = document.getElementById('id'); let value = el.style.borderImageOutset;

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

The computed value is the one that comes from evaluating the relative units and taking into account any inherited values. If the property border-image-outset hasn't been set, the computed value will be the initial value (0), but in any case, it is defined.

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

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

JQuery also offers specific syntaxes for handling CSS properties.

JQuery

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

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

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

Other code examples.

Other examples of Javascript and JQuery code are given on the page Javascript and CSS.

Test it yourself.

The buttons below apply the entered value to the border-image-outset property and then show either the value as it was applied or the computed value. This second option lets you see how the value of border-image-outset is stored (serialized). In particular, you'll notice that all units are converted to pixels except for numbers without a unit, which stay the same.

Simulator.

border-image-outset :

Browsers compatibility with border-image-outset.

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

Column 1
Possibility to use images to create borders and, therefore, support for the border-image property.
Column 2
Correct handling by browsers of the border-image-outset property, which specifies space between the edge of the element and its border.

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-outset
property
Estimated overall support.
97%
97%

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-outset 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-outset First definition of the border-image-outset property with the introduction of image-borders.
    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 W3C specification called CSS Backgrounds and Borders Module. 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.