CSS border-image-outset Property

The border-image-outset property specifies how far a border image extends beyond an element's border box.

It accepts nonnegative lengths or numbers that multiply the corresponding computed border widths. One to four values can be used to control individual sides. The property changes where the border image is painted without increasing the element's layout dimensions.

border-image-outset Syntax

selector {
  border-image-outset: 10px;
}

The property accepts one to four nonnegative length or number values.

Basic Length Value

.frame {
  border-image-outset: 10px;
}

The border image extends 10 pixels beyond every side of the border box.

Unitless Number

.frame {
  border-image-outset: 2;
}

The value 2 extends the border image by twice the corresponding computed border width on each side.

Different Vertical and Horizontal Values

.frame {
  border-image-outset: 10px 20px;
}

The border image extends 10 pixels beyond the top and bottom and 20 pixels beyond the left and right.

Four Individual Values

.frame {
  border-image-outset: 5px 10px 15px 20px;
}

The values apply clockwise to the top, right, bottom, and left sides.

CSS-Wide Keywords

.inherited {
  border-image-outset: inherit;
}
.reset {
  border-image-outset: initial;
}
.unset {
  border-image-outset: unset;
}
.reverted {
  border-image-outset: revert;
}
.layer-reverted {
  border-image-outset: revert-layer;
}

CSS-wide keywords must be used alone and cannot be combined with length or number values.

Property Values

Value Description
<length> Specifies a nonnegative distance, such as px, rem, or em, beyond the border box.
<number> Specifies a nonnegative multiplier of the corresponding computed border width.
One value Applies the same outset value to all four sides.
Two values Sets the top and bottom first, then the right and left.
Three values Sets the top, right and left, then bottom.
Four values Sets the top, right, bottom, and left individually.
0 Does not extend the border image beyond the border box. This is the initial value.

CSS-Wide Keywords

Keyword Behavior
inherit Uses the parent's computed outset value.
initial Resets the outset to 0.
unset Resets the outset to 0 because the property is not inherited.
revert Reverts the value according to cascade origin rules.
revert-layer Reverts the value according to cascade layer rules.

The initial value is 0. The property is not inherited, and its values are not animatable.

How It Works

The border-image-outset property expands the area available for painting a border image beyond the element's border box.

The border box itself remains unchanged. Only the border-image painting area extends outward.

Without an Outset

.frame {
  border: 10px solid transparent;
  border-image: linear-gradient(90deg, #1769aa, #27ae60) 1;
  border-image-outset: 0;
}

The border image is painted within the normal border-image area, which matches the border box when no outset is specified.

With an Outset

.frame {
  border: 10px solid transparent;
  border-image: linear-gradient(90deg, #1769aa, #27ae60) 1;
  border-image-outset: 10px;
}

The border image extends 10 pixels beyond the border box on all four sides.

Outset Does Not Add Layout Space

.frame {
  width: 240px;
  padding: 20px;
  border: 10px solid transparent;
  border-image: linear-gradient(90deg, #1769aa, #27ae60) 1;
  border-image-outset: 20px;
}

The 20-pixel outset changes the painted area but does not increase the element's computed width, padding, or border width.

Outset Requires a Border Image

.frame {
  border: 10px solid #1769aa;
  border-image-outset: 20px;
}

Without a border-image source, the regular border is painted normally. The outset does not extend a standard solid border.

Outset With a Gradient Source

.frame {
  border: 8px solid transparent;
  border-image-source: linear-gradient(90deg, #1769aa, #27ae60);
  border-image-slice: 1;
  border-image-outset: 12px;
}

The gradient supplies the border image, and the outset expands its painting area by 12 pixels.

One to Four Values

Like margin, padding, and border-width shorthand values, border-image-outset uses a clockwise assignment pattern.

One Value

.frame {
  border-image-outset: 10px;
}

All four sides extend 10 pixels beyond the border box.

Two Values

.frame {
  border-image-outset: 10px 20px;
}

The top and bottom extend 10 pixels. The right and left extend 20 pixels.

Three Values

.frame {
  border-image-outset: 5px 10px 15px;
}

The top extends 5 pixels, the right and left extend 10 pixels, and the bottom extends 15 pixels.

Four Values

.frame {
  border-image-outset: 5px 10px 15px 20px;
}

The top extends 5 pixels, the right extends 10 pixels, the bottom extends 15 pixels, and the left extends 20 pixels.

Mixed Lengths and Numbers

.frame {
  border-image-outset: 10px 2 1rem 0;
}

The top uses 10 pixels, the right uses twice its computed border width, the bottom uses 1rem, and the left has no outset.

Value Assignment Summary

Number of Values Assignment
1 All four sides
2 Top/bottom, right/left
3 Top, right/left, bottom
4 Top, right, bottom, left

These values follow physical sides. They do not change their assignment based on writing mode or text direction.

Lengths and Multipliers

The property accepts two types of values: CSS lengths and unitless numbers.

Pixel Length

.frame {
  border-image-outset: 12px;
}

The border image extends 12 pixels beyond every side of the border box.

rem Length

.frame {
  border-image-outset: 0.75rem;
}

The outset is calculated relative to the root element's font size.

em Length

.frame {
  border-image-outset: 1em;
}

The outset is calculated relative to the element's font size.

Unitless Multiplier

.frame {
  border: 8px solid transparent;
  border-image-outset: 2;
}

The outset is twice the computed border width. With an 8-pixel border on each side, the image extends 16 pixels beyond each side.

Fractional Multiplier

.frame {
  border: 12px solid transparent;
  border-image-outset: 0.5;
}

The image extends half the computed border width, or 6 pixels on each side.

Different Border Widths

.frame {
  border-style: solid;
  border-color: transparent;
  border-width: 5px 10px 15px 20px;
  border-image-outset: 2;
}

Each side's outset is calculated separately. The resulting outsets are 10 pixels at the top, 20 pixels at the right, 30 pixels at the bottom, and 40 pixels at the left.

Using calc()

.frame {
  border-image-outset: calc(8px + 0.5rem);
}

The calc() function combines compatible length values into a calculated outset.

Using clamp()

.frame {
  border-image-outset: clamp(4px, 1vw, 16px);
}

The outset adjusts with viewport width while remaining within the specified minimum and maximum.

Using Custom Properties

:root {
  --frame-outset: 12px;
}
.frame {
  border-image-outset: var(--frame-outset);
}

A custom property allows the same outset value to be reused across multiple components.

Invalid Negative Values

.invalid {
  border-image-outset: -10px;
}

Negative outset values are invalid. The browser ignores the declaration.

Percentages Are Not Supported

.invalid {
  border-image-outset: 10%;
}

Unlike border-image-slice and border-image-width, the border-image-outset property does not accept percentage values.

Border Image Shorthand

The border-image-outset property is one of five components controlled by the border-image shorthand.

Complete Shorthand Syntax

.frame {
  border-image: url("frame.png") 30 / 12px / 8px round;
}

The first slash introduces border-image-width. The second slash introduces border-image-outset.

Equivalent Longhand Declarations

.frame {
  border-image-source: url("frame.png");
  border-image-slice: 30;
  border-image-width: 12px;
  border-image-outset: 8px;
  border-image-repeat: round;
}

These declarations produce the same border-image configuration as the complete shorthand.

Outset Without an Explicit Image Width

.frame {
  border-image: url("frame.png") 30 / / 8px round;
}

The empty width position retains the initial border-image-width value of 1. The outset is set to 8 pixels.

Shorthand Reset Behavior

.frame {
  border-image-outset: 12px;
  border-image: url("frame.png") 30 round;
}

The later shorthand resets the outset to 0 because it does not specify an outset value.

Longhand After Shorthand

.frame {
  border-image: url("frame.png") 30 round;
  border-image-outset: 12px;
}

The later longhand changes only the outset. The image source, slice, width, and repeat behavior remain unchanged.

Gradient Border With Outset

.frame {
  border: 8px solid transparent;
  border-image: linear-gradient(90deg, #1769aa, #27ae60) 1 / 8px / 10px;
}

The gradient border is painted with an 8-pixel image width and extends 10 pixels beyond the border box.

When adjusting only the outset, a separate border-image-outset declaration is often easier to read than rewriting the entire shorthand.

Border Image Width vs. Outset

The border-image-width and border-image-outset properties control different aspects of border-image painting.

Property Purpose
border-image-width Controls the thickness of the painted border-image regions.
border-image-outset Controls how far the border-image painting area extends beyond the border box.
border-width Controls the regular border width used by the box model.

Changing Painted Width

.frame {
  border: 8px solid transparent;
  border-image: linear-gradient(90deg, #1769aa, #27ae60) 1;
  border-image-width: 16px;
}

The border-image regions are painted 16 pixels wide. The regular border still contributes 8 pixels per side to layout.

Changing Outset

.frame {
  border: 8px solid transparent;
  border-image: linear-gradient(90deg, #1769aa, #27ae60) 1;
  border-image-outset: 16px;
}

The border-image area extends 16 pixels beyond the border box, while the default painted border-image width remains 8 pixels.

Changing Both

.frame {
  border: 8px solid transparent;
  border-image: linear-gradient(90deg, #1769aa, #27ae60) 1;
  border-image-width: 16px;
  border-image-outset: 12px;
}

The image border is painted 16 pixels wide within a border-image area that extends 12 pixels beyond the border box.

Using the Shorthand

.frame {
  border: 8px solid transparent;
  border-image: linear-gradient(90deg, #1769aa, #27ae60) 1 / 16px / 12px;
}

This shorthand produces the same painted width and outset as the preceding longhand example.

Increasing border-image-width does not automatically increase the outset. Likewise, increasing the outset does not automatically make the painted border thicker.

Box Model and Layout

The border-image outset affects painting rather than layout. It does not alter the element's content box, padding box, border box, or margin box.

Content-Box Sizing

.frame {
  box-sizing: content-box;
  width: 240px;
  padding: 20px;
  border: 10px solid transparent;
  border-image: linear-gradient(90deg, #1769aa, #27ae60) 1;
  border-image-outset: 20px;
}

The declared width applies to the content box. Padding and regular border widths increase the total box width, but the outset does not.

Border-Box Sizing

.frame {
  box-sizing: border-box;
  width: 240px;
  padding: 20px;
  border: 10px solid transparent;
  border-image: linear-gradient(90deg, #1769aa, #27ae60) 1;
  border-image-outset: 20px;
}

The declared width includes padding and regular border widths. The 20-pixel outset remains outside that layout calculation.

Margins and Outset

.frame {
  margin: 30px;
  border: 10px solid transparent;
  border-image: linear-gradient(90deg, #1769aa, #27ae60) 1;
  border-image-outset: 15px;
}

The margin creates layout spacing around the element. The outset extends the border-image painting area without adding more margin.

Neighboring Elements

.frame {
  margin-bottom: 30px;
  border: 10px solid transparent;
  border-image: linear-gradient(90deg, #1769aa, #27ae60) 1;
  border-image-outset: 20px;
}

The outset may paint into surrounding space. It does not push neighboring elements farther away.

No Effect on Box Dimensions

Changing border-image-outset does not change the computed width, height, padding, border-width, or margin values.

When a decorative border needs extra clearance, use margins, padding on a surrounding container, or layout gaps to provide that space.

Overflow and Painting

Because an outset extends the painted border image beyond the border box, surrounding layout and overflow behavior can affect its visibility.

Visible Overflow

.frame {
  border: 10px solid transparent;
  border-image: linear-gradient(90deg, #1769aa, #27ae60) 1;
  border-image-outset: 15px;
  overflow: visible;
}

The border image can extend beyond the border box. The outset is part of the element's visual painting rather than its layout dimensions.

Clipping by an Ancestor

.frame-container {
  overflow: hidden;
}
.frame {
  border: 10px solid transparent;
  border-image: linear-gradient(90deg, #1769aa, #27ae60) 1;
  border-image-outset: 20px;
}

An ancestor with overflow: hidden may clip portions of the border image that extend outside the ancestor's clipping area.

Providing Clearance

.frame-container {
  padding: 24px;
  overflow: hidden;
}
.frame {
  border: 10px solid transparent;
  border-image: linear-gradient(90deg, #1769aa, #27ae60) 1;
  border-image-outset: 16px;
}

Padding on the surrounding container provides room for the extended border image before it reaches the container's clipping edge.

Outset and Hit Testing

The extended border-image area is decorative. It does not enlarge the element's hit-testing area or make the extra painted region clickable.

Outset and Shadows

.frame {
  border: 10px solid transparent;
  border-image: linear-gradient(90deg, #1769aa, #27ae60) 1;
  border-image-outset: 12px;
  box-shadow: 0 4px 12px rgb(0 0 0 / 15%);
}

The border image and box shadow are painted using their own rules. The border-image outset does not change the box shadow's underlying border-box geometry.

Test decorative borders near container edges, especially when an ancestor uses overflow clipping.

Responsive Outset Values

Responsive outset values allow decorative borders to extend different distances on different screen sizes.

Relative Length

.responsive-frame {
  border-image-outset: 0.75rem;
}

The outset responds to changes in the root font size.

Viewport-Based Length

.responsive-frame {
  border-image-outset: 1vw;
}

The outset is based on viewport width.

Clamped Outset

.responsive-frame {
  border-image-outset: clamp(4px, 1vw, 16px);
}

The outset adjusts with the viewport while remaining between 4 and 16 pixels.

Media Query Adjustment

.responsive-frame {
  border-image-outset: 16px;
}
@media (max-width: 600px) {
  .responsive-frame {
    border-image-outset: 6px;
  }
}

The border image extends a smaller distance on narrow screens.

Container Query Adjustment

.frame-container {
  container-type: inline-size;
}
.responsive-frame {
  border-image-outset: 6px;
}
@container (min-width: 500px) {
  .responsive-frame {
    border-image-outset: 16px;
  }
}

The outset increases when the query container reaches the specified width.

Multiplier With Responsive Border Width

.responsive-frame {
  border: clamp(4px, 1vw, 12px) solid transparent;
  border-image: linear-gradient(90deg, #1769aa, #27ae60) 1;
  border-image-outset: 1.5;
}

The unitless multiplier causes the outset to scale automatically with the computed border width.

Responsive outsets are useful when a decorative frame needs more breathing room on larger screens but must remain compact on smaller screens.

Practical Uses

The border-image-outset property is useful for decorative borders that should extend outside an element's normal border box.

Extended Gradient Frame

.gradient-frame {
  padding: 20px;
  border: 8px solid transparent;
  border-image: linear-gradient(90deg, #1769aa, #27ae60) 1;
  border-image-outset: 12px;
}

The gradient border extends beyond the element's border box.

Decorative Image Frame

.decorative-frame {
  padding: 24px;
  border: 16px solid transparent;
  border-image: url("decorative-frame.png") 32 round;
  border-image-outset: 8px;
}

The custom image frame extends outward without changing the content area's dimensions.

Asymmetric Border Extension

.asymmetric-frame {
  border: 10px solid transparent;
  border-image: linear-gradient(90deg, #1769aa, #27ae60) 1;
  border-image-outset: 0 20px 10px 5px;
}

The border image extends different distances on each side.

Top and Bottom Accent

.accent-frame {
  border: 8px solid transparent;
  border-image: linear-gradient(90deg, #1769aa, #27ae60) 1;
  border-image-outset: 12px 0;
}

The border image extends above and below the element while remaining aligned with the border box horizontally.

Responsive Decorative Panel

.decorative-panel {
  padding: 20px;
  border: 8px solid transparent;
  border-image: linear-gradient(135deg, #1769aa, #8e44ad) 1;
  border-image-outset: clamp(4px, 1vw, 14px);
}

The outset changes with viewport width while staying within a controlled range.

Reusable Outset Variable

:root {
  --decorative-outset: 12px;
}
.decorative-frame {
  border-image-outset: var(--decorative-outset);
}

The custom property provides a consistent outset value across multiple components.

border-image-outset Example

The following example compares border images with no outset, a 10-pixel outset, and a 20-pixel outset. Each box uses the same gradient and border width.

<div class="border-outset-demo">
  <div class="demo-item">
    <h3>No Outset</h3>
    <div class="demo-box outset-zero">0</div>
  </div>
  <div class="demo-item">
    <h3>10px Outset</h3>
    <div class="demo-box outset-ten">10px</div>
  </div>
  <div class="demo-item">
    <h3>20px Outset</h3>
    <div class="demo-box outset-twenty">20px</div>
  </div>
</div>
.border-outset-demo {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 30px;
  padding: 25px;
}
.border-outset-demo .demo-item {
  min-width: 0;
}
.border-outset-demo h3 {
  margin-bottom: 20px;
  font-size: 1rem;
}
.border-outset-demo .demo-box {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  padding: 20px;
  border: 10px solid transparent;
  border-image: linear-gradient(90deg, #1769aa, #27ae60) 1;
  background-color: #f3f8fc;
  color: #173b5e;
  font-weight: bold;
  text-align: center;
}
.border-outset-demo .outset-zero {
  border-image-outset: 0;
}
.border-outset-demo .outset-ten {
  border-image-outset: 10px;
}
.border-outset-demo .outset-twenty {
  border-image-outset: 20px;
}
Browser Result

No Outset

0

10px Outset

10px

20px Outset

20px

The first box paints its border image without extending beyond the border box.

The second box extends the border image 10 pixels beyond the border box.

The third box extends the border image 20 pixels beyond the border box.

All three boxes retain the same layout dimensions. Only the painted border-image area changes.

Important Considerations

Keep the following points in mind when using border-image-outset:

  • Purpose: Extends a border image beyond the element's border box.
  • Initial value: The initial outset is 0.
  • Inheritance: The property is not inherited.
  • Accepted values: Supports nonnegative lengths and unitless numbers.
  • Number values: Multiply the corresponding computed border width.
  • One to four values: Supports separate outsets for the top, right, bottom, and left sides.
  • Physical sides: Value assignment follows physical sides rather than logical writing directions.
  • Percentages: Percentage values are not supported.
  • Negative values: Negative values are invalid.
  • Zero value: An outset of 0 does not extend the border-image area.
  • Image source: The property has no visible effect without a border-image source.
  • Layout: Outset does not increase the element's layout dimensions.
  • Box model: Regular border widths continue to determine border space in layout.
  • Painted width: border-image-width controls the thickness of the painted border-image regions.
  • Overflow: Ancestor overflow clipping may hide parts of an extended border image.
  • Hit testing: The extended border-image area does not enlarge the element's clickable region.
  • Shorthand: The property can be set using the second slash-separated component of border-image.
  • Shorthand resets: A later border-image shorthand without an outset resets the outset to 0.
  • Animation: The property is not animatable.
  • Spacing: Provide adequate layout space when the border image extends toward neighboring content.
  • Browser support: Modern browsers support the standard property without vendor prefixes.

Use border-image-outset when decorative border artwork needs to extend outside an element's normal border box without changing the layout dimensions.

Browser Support

The border-image-outset property is widely available and supported in current versions of Chrome, Edge, Firefox, Safari, and other major browsers.

The standard property does not require vendor prefixes in modern browsers.

Standard Declaration

.frame {
  border: 10px solid transparent;
  border-image: url("frame.png") 30 round;
  border-image-outset: 12px;
}

Gradient Declaration

.frame {
  border: 8px solid transparent;
  border-image: linear-gradient(90deg, #1769aa, #27ae60) 1;
  border-image-outset: 10px;
}

Both examples use standard CSS border-image syntax.

Fallback Border

.frame {
  border: 8px solid #1769aa;
  border-image: linear-gradient(90deg, #1769aa, #27ae60) 1;
  border-image-outset: 10px;
}

The regular border color provides a fallback if the border image cannot be used. The fallback border itself does not extend beyond the border box.

Visit Can I Use? and search for border-image-outset to review browser compatibility.

Specifications

The border-image-outset property is defined in the CSS Backgrounds and Borders Module Level 3 specification.

CSS Backgrounds and Borders Module Level 3

The specification defines how outset values expand the border-image area beyond the border box and how number values relate to computed border widths.

Related border-image painting behavior is covered in the same specification.

CSS Border Images