CSS border-inline-width Property

The border-inline-width property sets the thickness of an element's logical inline-start and inline-end borders.

It accepts one or two width values. A single value applies to both inline borders, while two values allow different thicknesses on each edge. The physical borders affected depend on the element's writing mode and text direction, allowing the same CSS to work with left-to-right, right-to-left, and vertical writing systems.

border-inline-width Syntax

The property accepts one or two non-negative CSS lengths or border-width keywords.

selector {
  border-inline-width: 5px;
}

One Value

.panel {
  border-inline-width: 5px;
}

Both inline borders are 5 pixels wide.

Two Values

.panel {
  border-inline-width: 8px 4px;
}

The inline-start border is 8 pixels wide, and the inline-end border is 4 pixels wide.

Keyword Values

.panel {
  border-inline-width: thin thick;
}

Relative Lengths

.panel {
  border-inline-width: 0.4em 0.2em;
}

Calculated Widths

.panel {
  border-inline-width: calc(2px + 0.2em) 4px;
}

Zero Width

.panel {
  border-inline-width: 0;
}

CSS-Wide Keywords

.inherited {
  border-inline-width: inherit;
}
.reset {
  border-inline-width: initial;
}
.unset {
  border-inline-width: unset;
}
.reverted {
  border-inline-width: revert;
}
.layer-reverted {
  border-inline-width: revert-layer;
}

Negative lengths and percentages are invalid. CSS-wide keywords must be used alone rather than combined with other values.

Property Values

The border-inline-width property accepts the standard CSS border-width values.

Value Description
<length> A non-negative CSS length, such as 2px, 0.25em, or 0.3rem.
thin A thin border width determined by the browser.
medium A medium border width determined by the browser.
thick A thick border width determined by the browser.
0 Sets the corresponding border width to zero.
inherit Inherits both computed inline border widths from the parent.
initial Resets both inline border widths to medium.
unset Resets both widths to medium because the underlying properties are not inherited.
revert Reverts both widths according to cascade origin rules.
revert-layer Reverts both widths according to cascade layer rules.

Property Characteristics

Characteristic Value
Initial value medium for both inline borders
Inherited No
Applies to Elements that support the corresponding border-width properties
Computed value As each underlying longhand: absolute length, or zero when its border style is none or hidden
Animation type As each underlying longhand: by computed length
Percentages Not accepted
Property type Shorthand
Logical axis Inline axis

The initial value of medium does not create visible borders by itself. The corresponding border styles must also permit the borders to be drawn.

How It Works

The browser determines the inline-start and inline-end edges, then applies the specified widths to the corresponding physical borders.

Step 1: Set Both Widths

.panel {
  border-inline-width: 5px;
}

Both inline borders have a specified width of 5 pixels, but no borders appear while their styles remain none.

Step 2: Add a Border Style

.panel {
  border-inline-width: 5px;
  border-inline-style: solid;
}

Both inline borders become visible and use currentcolor unless another color is specified.

Step 3: Add a Color

.panel {
  border-inline-width: 5px;
  border-inline-style: solid;
  border-inline-color: #1769aa;
}

Both inline borders become solid blue lines.

Step 4: Use Different Widths

.panel {
  border-inline-width: 10px 4px;
  border-inline-style: solid;
  border-inline-color: #1769aa;
}

The inline-start border becomes 10 pixels wide, while the inline-end border becomes 4 pixels wide.

Step 5: Change the Direction

.panel {
  direction: rtl;
  border-inline-width: 10px 4px;
  border-inline-style: solid;
  border-inline-color: #1769aa;
}

In horizontal right-to-left writing, the 10-pixel border appears on the right and the 4-pixel border appears on the left.

The property controls thickness, while writing mode and direction determine which physical edges receive those widths.

One vs. Two Values

The number of values determines whether both inline borders share the same width or use different widths.

One Value

.panel {
  border-inline-width: 5px;
}

The single value applies to both inline-start and inline-end.

Equivalent Longhands

.panel {
  border-inline-start-width: 5px;
  border-inline-end-width: 5px;
}

These declarations produce the same result as the single-value shorthand.

Two Values

.panel {
  border-inline-width: 10px 4px;
}

The first value applies to inline-start. The second applies to inline-end.

Equivalent Longhands

.panel {
  border-inline-start-width: 10px;
  border-inline-end-width: 4px;
}

These declarations produce the same result as the two-value shorthand.

Remove the Inline-End Width

.panel {
  border-inline-width: 5px 0;
}

The inline-start border has a width of 5 pixels, while the inline-end border has zero width.

Remove the Inline-Start Width

.panel {
  border-inline-width: 0 5px;
}

The inline-start border has zero width, while the inline-end border has a width of 5 pixels.

Invalid Three-Value Syntax

.panel {
  border-inline-width: 5px 10px 15px;
}

This declaration is invalid because the property accepts no more than two width values.

Unlike the four-sided border-width shorthand, border-inline-width does not accept three or four values.

Writing Modes and Direction

The writing-mode and direction properties determine which physical edges correspond to inline-start and inline-end.

Writing Mode Direction Inline-Start Inline-End
horizontal-tb ltr Left Right
horizontal-tb rtl Right Left
vertical-rl ltr Top Bottom
vertical-rl rtl Bottom Top
vertical-lr ltr Top Bottom
vertical-lr rtl Bottom Top
sideways-rl ltr Top Bottom
sideways-lr ltr Bottom Top

Horizontal Left-to-Right

.panel {
  writing-mode: horizontal-tb;
  direction: ltr;
  border-inline-width: 10px 4px;
  border-inline-style: solid;
  border-inline-color: #1769aa;
}

The left border is 10 pixels wide, and the right border is 4 pixels wide.

Horizontal Right-to-Left

.panel {
  writing-mode: horizontal-tb;
  direction: rtl;
  border-inline-width: 10px 4px;
  border-inline-style: solid;
  border-inline-color: #1769aa;
}

The right border is 10 pixels wide, and the left border is 4 pixels wide.

Vertical Left-to-Right Progression

.panel {
  writing-mode: vertical-rl;
  direction: ltr;
  border-inline-width: 10px 4px;
  border-inline-style: solid;
  border-inline-color: #1769aa;
}

The top border is 10 pixels wide, and the bottom border is 4 pixels wide.

Vertical Right-to-Left Progression

.panel {
  writing-mode: vertical-lr;
  direction: rtl;
  border-inline-width: 10px 4px;
  border-inline-style: solid;
  border-inline-color: #1769aa;
}

The bottom border is 10 pixels wide, and the top border is 4 pixels wide.

Using the HTML dir Attribute

<div dir="ltr" class="directional-panel">
  Left-to-right content
</div>
<div dir="rtl" class="directional-panel">
  Right-to-left content
</div>
.directional-panel {
  padding: 20px;
  border-inline-width: 10px 4px;
  border-inline-style: solid;
  border-inline-color: #1769aa;
}

The same CSS applies the thicker border to the logical starting edge in both text directions.

Logical border widths eliminate the need to manually exchange left and right border widths for many multilingual layouts.

Length Values

The border-inline-width property supports non-negative CSS lengths, including absolute and relative units.

Pixels

.panel {
  border-inline-width: 8px 4px;
}

Pixels provide predictable CSS border thicknesses.

em Units

.panel {
  border-inline-width: 0.4em 0.2em;
}

The widths are calculated relative to the element's font size.

rem Units

.panel {
  border-inline-width: 0.5rem 0.25rem;
}

The widths are calculated relative to the root element's font size.

Points

.panel {
  border-inline-width: 6pt 3pt;
}

Points are absolute CSS length units. One point equals one seventy-second of a CSS inch.

Viewport Units

.panel {
  border-inline-width: 1vw 0.5vw;
}

The widths are calculated relative to the viewport width. Large viewports can produce unusually thick borders.

Calculated Widths

.panel {
  border-inline-width: calc(2px + 0.3em) 4px;
}

The calc() function combines compatible length values.

Clamped Widths

.panel {
  border-inline-width: clamp(3px, 0.6vw, 10px) 4px;
}

The first width stays between 3 and 10 pixels, while the second remains 4 pixels.

Zero Width

.panel {
  border-inline-width: 0;
}

Zero does not require a unit and removes both inline borders' thickness.

Invalid Percentage

.panel {
  border-inline-width: 10% 5%;
}

This declaration is invalid because percentages are not accepted.

Invalid Negative Width

.panel {
  border-inline-width: -5px 4px;
}

Negative border widths are invalid.

Use explicit lengths when a design requires specific thicknesses across browsers.

Keyword Widths

The thin, medium, and thick keywords provide browser-defined border widths.

thin

.panel {
  border-inline-width: thin;
  border-inline-style: solid;
  border-inline-color: #1769aa;
}

Both inline borders use a thin width.

medium

.panel {
  border-inline-width: medium;
  border-inline-style: solid;
  border-inline-color: #1769aa;
}

Both inline borders use a medium width.

thick

.panel {
  border-inline-width: thick;
  border-inline-style: solid;
  border-inline-color: #1769aa;
}

Both inline borders use a thick width.

Different Keywords

.panel {
  border-inline-width: thick thin;
  border-inline-style: solid;
  border-inline-color: #1769aa;
}

The inline-start border is thick, while the inline-end border is thin.

Mixing Keywords and Lengths

.panel {
  border-inline-width: thick 4px;
  border-inline-style: solid;
  border-inline-color: #1769aa;
}

The inline-start border uses the browser-defined thick width, while the inline-end border is 4 pixels wide.

Keyword vs. Explicit Length

.keyword-panel {
  border-inline: thick solid #1769aa;
}
.fixed-panel {
  border-inline: 6px solid #1769aa;
}

The keyword uses a browser-defined thickness. The explicit length requests a 6-pixel CSS border.

The relative ordering is thin, medium, and thick, but their exact pixel equivalents are determined by the browser.

Border Visibility

Setting border widths does not guarantee visible borders. The corresponding border styles and colors also affect the result.

Widths Without Styles

.panel {
  border-inline-width: 5px;
}

Neither border is visible because both styles initially equal none.

Visible Borders

.panel {
  border-inline-width: 5px;
  border-inline-style: solid;
  border-inline-color: #1769aa;
}

Both borders become visible.

Style none

.panel {
  border-inline-width: 5px;
  border-inline-style: none;
  border-inline-color: #1769aa;
}

The computed widths become zero because the styles are none.

Style hidden

.panel {
  border-inline-width: 5px;
  border-inline-style: hidden;
  border-inline-color: #1769aa;
}

Neither border is drawn, and their computed widths become zero.

One Visible Border

.panel {
  border-inline-width: 5px;
  border-inline-style: solid none;
  border-inline-color: #1769aa;
}

Only the inline-start border is visible.

Transparent Borders

.panel {
  border-inline-width: 5px;
  border-inline-style: solid;
  border-inline-color: transparent;
}

The borders are transparent but still occupy space.

Zero Width

.panel {
  border-inline-width: 0;
  border-inline-style: solid;
  border-inline-color: #1769aa;
}

Neither border has visible thickness.

When a border does not appear, check its width, style, color, and any border-image settings that may affect rendering.

Width, Style, and Color

The logical inline borders have three primary components: width, style, and color.

Width Shorthand

.panel {
  border-inline-width: 8px 4px;
}

Controls the thickness of both inline borders.

Style Shorthand

.panel {
  border-inline-style: dashed solid;
}

Controls the line patterns.

Color Shorthand

.panel {
  border-inline-color: #1769aa #27ae60;
}

Controls the border colors.

Combined Properties

.panel {
  border-inline-width: 8px 4px;
  border-inline-style: dashed solid;
  border-inline-color: #1769aa #27ae60;
}

The inline-start border is 8 pixels wide, dashed, and blue. The inline-end border is 4 pixels wide, solid, and green.

Change Only the Widths

.panel {
  border-inline: 5px solid #1769aa;
  border-inline-width: 10px 4px;
}

The border widths change without modifying their styles or colors.

Change Only the Styles

.panel {
  border-inline: 5px solid #1769aa;
  border-inline-style: dashed dotted;
}

The border styles change without modifying their widths or colors.

Change Only the Colors

.panel {
  border-inline: 5px solid #1769aa;
  border-inline-color: #27ae60 #c0392b;
}

The border colors change without modifying their widths or styles.

Use border-inline-width when changing thickness without resetting the existing border styles or colors.

Shorthand Properties

The border-inline-width property is a shorthand for the inline-start and inline-end border-width longhands.

Equivalent Longhands

.panel {
  border-inline-start-width: 10px;
  border-inline-end-width: 4px;
}

Equivalent Shorthand

.panel {
  border-inline-width: 10px 4px;
}

Both examples set the same widths.

border-inline Shorthand

.panel {
  border-inline: 5px solid #1769aa;
}

This sets both inline borders to the same width, style, and color.

Override One Width

.panel {
  border-inline: 5px solid #1769aa;
  border-inline-start-width: 10px;
}

The inline-start border becomes 10 pixels wide while the inline-end border remains 5 pixels wide.

Override Both Widths

.panel {
  border-inline: 5px solid #1769aa;
  border-inline-width: 10px 4px;
}

The widths change without affecting the solid style or blue color.

border-inline-start Shorthand

.panel {
  border-inline-width: 10px 4px;
  border-inline-start: 8px solid #1769aa;
}

The later inline-start shorthand changes that border's width to 8 pixels. The inline-end width remains 4 pixels.

border Shorthand

.panel {
  border: 2px solid #cccccc;
  border-inline-width: 10px 4px;
}

All four borders are initially 2 pixels wide. The logical inline-start and inline-end borders then receive widths of 10 and 4 pixels.

Shorthand Reset

.panel {
  border-inline-width: 10px 4px;
  border-inline: 5px solid #1769aa;
}

The later border-inline shorthand resets both widths to 5 pixels.

One-Value Shorthand Reset

.panel {
  border-inline-start-width: 10px;
  border-inline-end-width: 4px;
  border-inline-width: 6px;
}

The final declaration changes both widths to 6 pixels.

Use the width shorthand when both logical inline borders need their thicknesses set together.

Physical vs. Logical Border Widths

Physical border-width properties target fixed edges, while logical border-width properties follow the inline axis.

Property Target
border-left-width Physical left border
border-right-width Physical right border
border-top-width Physical top border
border-bottom-width Physical bottom border
border-inline-start-width Logical inline-start border
border-inline-end-width Logical inline-end border
border-inline-width Both logical inline borders

Physical Left and Right Borders

.panel {
  border-left: 10px solid #1769aa;
  border-right: 4px solid #1769aa;
}

The left border remains 10 pixels wide and the right border remains 4 pixels wide, regardless of text direction.

Logical Inline Borders

.panel {
  border-inline-width: 10px 4px;
  border-inline-style: solid;
  border-inline-color: #1769aa;
}

The thicker border follows inline-start, while the thinner border follows inline-end.

Horizontal LTR

.panel {
  direction: ltr;
  border-inline: 5px solid #1769aa;
  border-inline-width: 10px 4px;
}

The left border is 10 pixels wide, and the right border is 4 pixels wide.

Horizontal RTL

.panel {
  direction: rtl;
  border-inline: 5px solid #1769aa;
  border-inline-width: 10px 4px;
}

The right border is 10 pixels wide, and the left border is 4 pixels wide.

Vertical Writing

.panel {
  writing-mode: vertical-rl;
  direction: ltr;
  border-inline: 5px solid #1769aa;
  border-inline-width: 10px 4px;
}

The top border is 10 pixels wide, and the bottom border is 4 pixels wide.

Physical and Logical Conflicts

.panel {
  border: 2px solid #cccccc;
  border-left-width: 8px;
  border-right-width: 6px;
  border-inline-width: 10px 4px;
}

In horizontal left-to-right writing, the later logical shorthand sets the left border to 10 pixels and the right border to 4 pixels when the declarations have equal cascade priority.

In horizontal right-to-left writing, the right border becomes 10 pixels wide and the left border becomes 4 pixels wide.

Prefer logical widths when borders should follow the direction of the content rather than remain attached to fixed physical sides.

Box Sizing and Layout

Inline border widths contribute to an element's dimensions. Their effect depends on box-sizing and the element's writing mode.

content-box

.panel {
  box-sizing: content-box;
  width: 300px;
  padding: 20px;
  border-inline: 10px solid #1769aa;
}

In horizontal writing mode, the declared width applies to the content box. Padding and inline borders increase the total rendered width.

border-box

.panel {
  box-sizing: border-box;
  width: 300px;
  padding: 20px;
  border-inline: 10px solid #1769aa;
}

The declared width includes padding and borders, subject to the element's minimum size and other layout constraints.

Different Inline Border Widths

.panel {
  box-sizing: border-box;
  width: 300px;
  padding: 20px;
  border-inline: 5px solid #1769aa;
  border-inline-width: 15px 5px;
}

In horizontal writing mode, the two inline borders contribute a combined 20 pixels to the border box.

Changing Border Thickness

.panel {
  box-sizing: content-box;
  border-inline: 5px solid #1769aa;
}
.panel.active {
  border-inline-width: 15px;
}

The active panel has thicker borders, which can increase its outer dimensions.

Reserving Border Space

.panel {
  border-inline: 10px solid transparent;
}
.panel.active {
  border-inline-color: #1769aa;
}

Changing only the color preserves the border widths and helps prevent layout shifts.

Logical Padding

.panel {
  padding-inline: 20px;
  border-inline-width: 10px 4px;
  border-inline-style: solid;
  border-inline-color: #1769aa;
}

The padding and borders follow the same logical inline axis.

Consider the element's box sizing and layout constraints when changing border widths dynamically.

Cascade and Overrides

The CSS cascade determines which border widths apply when multiple declarations affect the same edges.

Later Declaration

.panel {
  border-inline-width: 5px;
  border-inline-width: 10px 4px;
}

The later declaration sets the inline-start width to 10 pixels and the inline-end width to 4 pixels when both declarations have equal cascade priority.

Higher Specificity

.panel {
  border-inline-width: 5px;
}
.panel.featured {
  border-inline-width: 10px 4px;
}

The featured panel uses the second declaration because its selector is more specific.

Longhand Override

.panel {
  border-inline-width: 10px 4px;
  border-inline-end-width: 8px;
}

The inline-start width remains 10 pixels, while the inline-end width becomes 8 pixels.

Shorthand Override

.panel {
  border-inline-width: 10px 4px;
  border-inline: 5px solid #1769aa;
}

The later shorthand resets both widths to 5 pixels.

Physical Width Conflict

.panel {
  border: 2px solid #cccccc;
  border-left-width: 8px;
  border-right-width: 6px;
  border-inline-width: 10px 4px;
}

In horizontal left-to-right writing, the logical shorthand targets the same physical edges as the left and right width declarations. The later logical values win when their cascade priority is otherwise equal.

CSS Layers

@layer base, components;
@layer base {
  .panel {
    border-inline-width: 2px;
  }
}
@layer components {
  .panel {
    border-inline-width: 10px 4px;
  }
}

For normal declarations, the later layer takes precedence, so the 10-pixel and 4-pixel widths win.

When the expected thickness does not appear, check the border styles, shorthand declarations, specificity, cascade layers, and writing direction.

CSS Custom Properties

CSS custom properties can store reusable border widths for both logical inline edges.

One Shared Width

:root {
  --inline-border-width: 5px;
}
.panel {
  border-inline-style: solid;
  border-inline-color: #1769aa;
  border-inline-width: var(--inline-border-width);
}

Both inline borders use the shared width.

Two Different Widths

:root {
  --inline-border-widths: 10px 4px;
}
.panel {
  border-inline-style: solid;
  border-inline-color: #1769aa;
  border-inline-width: var(--inline-border-widths);
}

The custom property supplies two width values.

Component Override

.panel {
  --inline-border-widths: 5px;
  border-inline-style: solid;
  border-inline-color: #1769aa;
  border-inline-width: var(--inline-border-widths);
}
.panel.featured {
  --inline-border-widths: 10px 4px;
}

The featured panel uses different widths.

Fallback Width

.panel {
  border-inline-style: solid;
  border-inline-color: #1769aa;
  border-inline-width: var(--inline-border-widths, 5px);
}

The fallback width is used when the custom property is unavailable or has the guaranteed-invalid value.

Theme-Based Widths

:root {
  --inline-border-widths: 4px;
}
[data-theme="bold"] {
  --inline-border-widths: 10px 6px;
}
.panel {
  border-inline-style: solid;
  border-inline-color: #1769aa;
  border-inline-width: var(--inline-border-widths);
}

The border thicknesses follow the selected theme.

Component Variants

.notice {
  --notice-border-widths: 5px;
  border-inline-style: solid;
  border-inline-color: #1769aa;
  border-inline-width: var(--notice-border-widths);
}
.notice.important {
  --notice-border-widths: 10px 4px;
}
.notice.subtle {
  --notice-border-widths: 2px;
}

Custom properties allow related components to share one border rule while using different thicknesses.

Interactive States

Logical border widths can change in response to hover, focus, selection, and other interface states.

Hover State

.panel {
  border-inline: 4px solid #1769aa;
}
.panel:hover {
  border-inline-width: 8px;
}

Both inline borders become thicker on hover.

Focus State

.form-field {
  border-inline: 4px solid #cccccc;
}
.form-field:focus {
  border-inline-width: 8px;
  border-inline-color: #1769aa;
}

Both borders become thicker and blue when the field receives focus.

Keyboard Focus

.form-field {
  border-inline: 4px solid #cccccc;
}
.form-field:focus-visible {
  border-inline-width: 6px;
  border-inline-color: #1769aa;
  outline: 2px solid #1769aa;
  outline-offset: 2px;
}

The outline provides an additional visible keyboard focus indicator.

Selected Item

.selectable-panel {
  border-inline: 3px solid #cccccc;
}
.selectable-panel.is-selected {
  border-inline-width: 8px;
  border-inline-color: #1769aa;
}

The selected panel uses thicker blue inline borders.

Current Navigation Item

.nav-link {
  border-inline: 4px solid transparent;
}
.nav-link[aria-current="page"] {
  border-inline-width: 6px;
  border-inline-color: #1769aa;
}

The current navigation item receives thicker accent borders.

Changing border widths can affect layout. When stable dimensions are important, reserve the border space and change its color instead.

Transitions and Animation

The underlying inline border-width properties can animate between compatible computed length values.

Basic Width Transition

.panel {
  border-inline: 4px solid #1769aa;
  transition: border-inline-width 0.3s ease;
}
.panel:hover {
  border-inline-width: 10px;
}

Both inline borders gradually become thicker on hover.

Different Target Widths

.panel {
  border-inline: 4px solid #1769aa;
  transition: border-inline-width 0.3s ease;
}
.panel:hover {
  border-inline-width: 12px 6px;
}

The inline-start border transitions toward 12 pixels, while the inline-end border transitions toward 6 pixels.

Individual Width Transitions

.panel {
  border-inline: 4px solid #1769aa;
  transition: border-inline-start-width 0.3s ease;
}
.panel:hover {
  border-inline-start-width: 12px;
}

Only the inline-start border width transitions.

Keyframe Animation

@keyframes inline-border-change {
  from {
    border-inline-width: 4px;
  }
  to {
    border-inline-width: 12px 6px;
  }
}
.animated-panel {
  border-inline: 4px solid #1769aa;
  animation: inline-border-change 2s ease-in-out infinite alternate;
}

The inline border widths animate between the specified values.

Reduced Motion Preference

.panel {
  border-inline: 4px solid #1769aa;
  transition: border-inline-width 0.3s ease;
}
.panel:hover {
  border-inline-width: 10px;
}
@media (prefers-reduced-motion: reduce) {
  .panel {
    transition: none;
  }
}

The transition is disabled when the user requests reduced motion.

Avoiding Layout Changes

.panel {
  border-inline: 10px solid transparent;
  transition: border-inline-color 0.3s ease;
}
.panel:hover {
  border-inline-color: #1769aa;
}

The border widths remain constant while the colors change, helping prevent layout shifts.

Animating border widths can trigger layout recalculation. Consider color transitions when a change in thickness is unnecessary.

Responsive Design

The border-inline-width property can adapt to viewport size, container size, and writing mode.

Media Query

.responsive-panel {
  border-inline: 8px solid #1769aa;
}
@media (max-width: 600px) {
  .responsive-panel {
    border-inline-width: 4px;
  }
}

Both inline borders become thinner on smaller screens.

Container Query

.panel-container {
  container-type: inline-size;
}
.responsive-panel {
  border-inline: 4px solid #1769aa;
}
@container (min-width: 500px) {
  .responsive-panel {
    border-inline-width: 10px 6px;
  }
}

The inline borders become thicker when the query container reaches the specified inline size.

clamp() for Fluid Widths

.responsive-panel {
  border-inline-style: solid;
  border-inline-color: #1769aa;
  border-inline-width: clamp(3px, 0.6vw, 10px) 4px;
}

The inline-start width stays between 3 and 10 pixels, while the inline-end width remains 4 pixels.

Responsive Writing Mode

.responsive-panel {
  writing-mode: horizontal-tb;
  border-inline: 5px solid #1769aa;
  border-inline-width: 10px 4px;
}
@media (min-width: 900px) {
  .responsive-panel {
    writing-mode: vertical-rl;
  }
}

With left-to-right inline progression, the 10-pixel and 4-pixel borders move from the left and right edges to the top and bottom edges.

Responsive Custom Property

.responsive-panel {
  --inline-border-widths: 10px 4px;
  border-inline-style: solid;
  border-inline-color: #1769aa;
  border-inline-width: var(--inline-border-widths);
}
@media (max-width: 600px) {
  .responsive-panel {
    --inline-border-widths: 5px 2px;
  }
}

The border widths change through a custom property.

Logical border widths are useful when responsive layouts must also adapt to different text directions.

Practical Uses

The border-inline-width property can create symmetrical or contrasting border accents along an element's inline axis.

Information Panel

.info-panel {
  padding: 20px;
  border-inline-width: 5px;
  border-inline-style: solid;
  border-inline-color: #1769aa;
  background-color: #f3f8fc;
}

Equal-width borders frame the panel along the inline axis.

Important Notice

.important-notice {
  padding: 20px;
  border-inline-width: 10px 4px;
  border-inline-style: solid;
  border-inline-color: #c0392b;
}

A thicker inline-start border creates stronger visual emphasis.

Blockquote

blockquote {
  padding-inline: 20px;
  border-inline-width: 5px 2px;
  border-inline-style: solid;
  border-inline-color: #1769aa;
}

The inline-start border is more prominent than the inline-end border.

Selected Card

.card {
  border-inline: 3px solid #dddddd;
}
.card.is-selected {
  border-inline-width: 10px 4px;
  border-inline-color: #1769aa;
}

The selected card receives a thicker starting border.

Current Navigation Item

.nav-link {
  border-inline: 4px solid transparent;
}
.nav-link[aria-current="page"] {
  border-inline-width: 8px 4px;
  border-inline-color: #1769aa;
}

The current navigation item uses a thicker inline-start border.

Form Validation

.form-field {
  border-inline: 3px solid #cccccc;
}
.form-field:invalid {
  border-inline-width: 8px 4px;
  border-inline-color: #c0392b;
}
.form-field:valid {
  border-inline-width: 5px;
  border-inline-color: #27ae60;
}

Border thickness and color can provide visual feedback. Include text feedback so validation meaning does not depend on appearance alone.

Theme-Based Widths

:root {
  --inline-border-widths: 4px;
}
[data-theme="bold"] {
  --inline-border-widths: 10px 6px;
}
.card {
  border-inline-style: solid;
  border-inline-color: #1769aa;
  border-inline-width: var(--inline-border-widths);
}

The border thicknesses follow the selected theme.

Choose widths that provide appropriate visual emphasis without overwhelming nearby content or causing unwanted layout changes.

border-inline-width Example

The following example compares several inline border-width combinations using the same solid style and blue color.

<div class="border-inline-width-demo">
  <div class="demo-box equal-thin">2px</div>
  <div class="demo-box equal-medium">5px</div>
  <div class="demo-box equal-thick">10px</div>
  <div class="demo-box start-thick">10px 4px</div>
  <div class="demo-box end-thick">4px 10px</div>
  <div class="demo-box start-only">8px 0</div>
  <div class="demo-box end-only">0 8px</div>
  <div class="demo-box mixed-keywords">thick thin</div>
</div>
.border-inline-width-demo {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}
.border-inline-width-demo .demo-box {
  box-sizing: border-box;
  padding: 20px;
  border-inline-style: solid;
  border-inline-color: #1769aa;
  background-color: #f3f8fc;
  color: #173b5e;
  font-weight: bold;
}
.border-inline-width-demo .equal-thin {
  border-inline-width: 2px;
}
.border-inline-width-demo .equal-medium {
  border-inline-width: 5px;
}
.border-inline-width-demo .equal-thick {
  border-inline-width: 10px;
}
.border-inline-width-demo .start-thick {
  border-inline-width: 10px 4px;
}
.border-inline-width-demo .end-thick {
  border-inline-width: 4px 10px;
}
.border-inline-width-demo .start-only {
  border-inline-width: 8px 0;
}
.border-inline-width-demo .end-only {
  border-inline-width: 0 8px;
}
.border-inline-width-demo .mixed-keywords {
  border-inline-width: thick thin;
}
Browser Result
2px
5px
10px
10px 4px
4px 10px
8px 0
0 8px
thick thin

The first three examples apply equal widths to both inline borders. The remaining examples demonstrate different widths, zero-width borders, and keyword values.

In horizontal left-to-right writing, the first value controls the left border and the second controls the right border. In right-to-left writing, their physical positions reverse.

Important Considerations

Keep the following points in mind when using border-inline-width:

  • Purpose: Sets the thicknesses of both logical inline borders.
  • Property type: Shorthand.
  • Underlying properties: border-inline-start-width and border-inline-end-width.
  • Initial values: medium for both borders.
  • Inheritance: The underlying properties are not inherited.
  • Logical axis: Follows the inline axis.
  • One value: Applies the same width to both inline borders.
  • Two values: The first applies to inline-start, and the second applies to inline-end.
  • Three or four values: Invalid.
  • Writing mode: Determines whether the inline axis is horizontal or vertical.
  • Direction: Determines which physical edges are inline-start and inline-end.
  • Horizontal LTR: Controls the left and right border widths.
  • Horizontal RTL: Controls the right and left border widths, respectively.
  • Vertical writing: Controls the top and bottom border widths according to inline progression.
  • Length values: Accepts non-negative CSS lengths.
  • Keyword values: Accepts thin, medium, and thick.
  • Percentages: Not accepted.
  • Negative values: Invalid.
  • Zero: Removes the corresponding border's thickness.
  • Style none: Produces a computed border width of zero.
  • Style hidden: Also produces a computed border width of zero.
  • Visible borders: Require suitable border styles and nonzero widths.
  • Color: Is controlled separately by border-inline-color.
  • Style: Is controlled separately by border-inline-style.
  • border-inline: Sets width, style, and color for both inline borders.
  • Physical borders: Can conflict with logical declarations when both target the same physical edge.
  • Shorthand resets: Later border shorthands may override the widths.
  • Box sizing: Border thickness contributes to an element's rendered dimensions.
  • Animation: The underlying widths can interpolate between compatible computed lengths.
  • Custom properties: Can store one or two reusable width values.
  • Responsive design: Supports media queries and container queries.
  • Accessibility: Do not rely on border thickness alone to communicate important information.
  • Browser support: Modern browsers support the standard property without vendor prefixes.

Use border-inline-width when both logical inline borders need their thicknesses set together without changing their styles or colors.

Browser Support

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

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

Basic Declaration

.panel {
  border-inline-width: 10px 4px;
  border-inline-style: solid;
  border-inline-color: #1769aa;
}

Right-to-Left Direction

.panel {
  direction: rtl;
  border-inline: 5px solid #1769aa;
  border-inline-width: 10px 4px;
}

Vertical Writing Mode

.panel {
  writing-mode: vertical-rl;
  border-inline: 5px solid #1769aa;
  border-inline-width: 10px 4px;
}

Physical Border Fallback

.panel {
  border-left: 10px solid #1769aa;
  border-right: 4px solid #1769aa;
}
@supports (border-inline-width: 10px 4px) {
  .panel {
    border-left: 0;
    border-right: 0;
    border-inline: 5px solid #1769aa;
    border-inline-width: 10px 4px;
  }
}

This fallback assumes horizontal left-to-right writing. Older browsers use physical left and right borders, while supporting browsers use logical inline borders.

Visit Can I Use? and search for border-inline-width to review browser compatibility.

Specifications

The border-inline-width property is defined in the CSS Logical Properties and Values Module Level 1 specification.

CSS Logical Properties and Values Module Level 1

The specification defines how one or two width values apply to the logical inline-start and inline-end borders.

Border-width values and rendering behavior are also defined by the CSS Backgrounds and Borders specification.

CSS Backgrounds and Borders Module Level 3