CSS border-inline Property

The border-inline shorthand property sets the width, style, and color of an element's logical inline-start and inline-end borders.

Unlike physical border properties that target the left or right sides, border-inline follows the element's writing mode and text direction. In horizontal writing modes, it generally styles the left and right borders. In vertical writing modes, it styles the top and bottom borders.

border-inline Syntax

selector {
  border-inline: 2px solid #1769aa;
}

The shorthand accepts a border width, border style, and border color. The components may appear in any order, and each component may be omitted.

Width, Style, and Color

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

Both logical inline borders are 4 pixels wide, solid, and blue.

Style and Color

.panel {
  border-inline: dashed #27ae60;
}

The inline borders use a dashed green style and the default medium border width.

Width and Style

.panel {
  border-inline: 3px dotted;
}

The borders are dotted and use the element's current text color.

Style Only

.panel {
  border-inline: double;
}

The inline borders use the double style with the initial width and color values.

Color Only

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

The color is assigned, but the borders are not visible because the omitted style resets to none.

Removing Inline Borders

.panel {
  border-inline: none;
}

Both logical inline borders are removed.

CSS-Wide Keywords

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

CSS-wide keywords must be used alone and cannot be combined with width, style, or color values.

Property Values

The border-inline shorthand combines three categories of border values.

Value Description
<line-width> Specifies the border thickness using a nonnegative length or the keywords thin, medium, or thick.
<line-style> Specifies the border style, such as solid, dashed, dotted, or double.
<color> Specifies the border color using a valid CSS color value.
none Sets the border style to none, preventing visible borders.
hidden Hides the border and has special conflict-resolution behavior in collapsed table borders.

Default Component Values

Component Initial Value
Border width medium
Border style none
Border color currentcolor

When a component is omitted from the shorthand, that component is reset to its initial value for both inline sides.

CSS-Wide Keywords

Keyword Behavior
inherit Inherits the corresponding computed border component values from the parent.
initial Resets all inline border components to their initial values.
unset Resets the non-inherited border components to their initial values.
revert Reverts the values according to cascade origin rules.
revert-layer Reverts the values according to cascade layer rules.

The shorthand itself does not have a single independent computed value. Its six longhand components determine the resulting border widths, styles, and colors.

How It Works

The border-inline property applies the same border declaration to both logical inline edges of an element.

Step 1: Identify the Inline Axis

.panel {
  writing-mode: horizontal-tb;
}

In horizontal writing mode, the inline axis runs horizontally.

Step 2: Determine the Inline Edges

.panel {
  direction: ltr;
}

With left-to-right direction, inline-start is the left edge and inline-end is the right edge.

Step 3: Apply the Border

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

The browser paints a 4-pixel solid blue border on both inline edges.

Step 4: Change the Writing Mode

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

The inline axis now runs vertically, so the same declaration styles the top and bottom edges.

Equivalent Longhand Declarations

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

These declarations provide the same inline border styling as the shorthand.

The important difference from physical border properties is that the logical edges are determined by the element's writing mode and direction.

Logical Inline Borders

CSS logical properties describe edges relative to the flow of content rather than fixed physical directions.

Inline Axis

The inline axis follows the direction in which text and other inline content progress within a line.

Inline-Start Edge

The inline-start edge is where inline content begins.

Inline-End Edge

The inline-end edge is where inline content ends.

Both Inline Edges

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

The shorthand applies the same width, style, and color to inline-start and inline-end.

Inline-Start Only

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

Only the logical inline-start edge receives the border.

Inline-End Only

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

Only the logical inline-end edge receives the border.

Why Logical Properties Matter

Logical properties allow the same CSS declarations to adapt to different writing systems without manually switching between left, right, top, and bottom properties.

This is especially useful for multilingual websites and components that support vertical writing modes.

Writing Modes

The writing-mode property determines whether the inline axis runs horizontally or vertically.

Horizontal Writing Mode

.horizontal-panel {
  writing-mode: horizontal-tb;
  border-inline: 4px solid #1769aa;
}

The inline borders appear on the left and right sides.

Vertical Right-to-Left Writing Mode

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

The inline borders appear on the top and bottom sides.

Vertical Left-to-Right Writing Mode

.vertical-lr-panel {
  writing-mode: vertical-lr;
  border-inline: 4px solid #1769aa;
}

The inline borders also appear on the top and bottom sides.

Sideways Writing Mode

.sideways-panel {
  writing-mode: sideways-rl;
  border-inline: 4px solid #1769aa;
}

The inline axis runs vertically, so the borders are painted on the top and bottom.

Writing Mode Comparison

Writing Mode Inline Axis Physical Border Sides
horizontal-tb Horizontal Left and right
vertical-rl Vertical Top and bottom
vertical-lr Vertical Top and bottom
sideways-rl Vertical Top and bottom
sideways-lr Vertical Top and bottom

The border-inline shorthand always targets both inline edges, regardless of which physical sides those edges represent.

Text Direction

The direction property influences which physical edge corresponds to inline-start and inline-end.

Left-to-Right Direction

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

In horizontal writing mode, inline-start is on the left and inline-end is on the right.

Right-to-Left Direction

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

In horizontal writing mode, inline-start is on the right and inline-end is on the left.

Same Appearance With border-inline

Because border-inline styles both inline edges identically, changing between left-to-right and right-to-left direction does not normally change which two physical sides have borders in horizontal writing mode.

Different Start and End Borders

.directional-panel {
  border-inline-start: 5px solid #1769aa;
  border-inline-end: 2px dashed #27ae60;
}

The start and end borders have different appearances and exchange physical positions when the inline direction reverses.

HTML Direction Attribute

<div dir="ltr" class="directional-panel">
  Left-to-right content
</div>
<div dir="rtl" class="directional-panel">
  Right-to-left content
</div>

The HTML dir attribute establishes the text direction for each element.

For multilingual documents, use the appropriate HTML direction attribute rather than relying on CSS alone to express the content's language direction.

Border Width

The width component controls the thickness of both logical inline borders.

Pixel Width

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

Both inline borders are 4 pixels thick.

thin Keyword

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

The borders use the browser's thin width.

medium Keyword

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

The borders use the browser's medium width.

thick Keyword

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

The borders use the browser's thick width.

Relative Width

.panel {
  border-inline: 0.25rem solid #1769aa;
}

The border thickness is based on the root element's font size.

Width Longhand

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

The width can also be set independently using border-inline-width.

Different Start and End Widths

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

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

The border-inline shorthand itself accepts only one width component. Use border-inline-width or the individual start and end properties when the two sides need different widths.

Border Style

The style component determines how the inline borders are drawn.

Solid

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

Both inline borders appear as continuous lines.

Dashed

.dashed-panel {
  border-inline: 4px dashed #1769aa;
}

Both inline borders appear as dashed lines.

Dotted

.dotted-panel {
  border-inline: 4px dotted #1769aa;
}

Both inline borders appear as dotted lines.

Double

.double-panel {
  border-inline: 6px double #1769aa;
}

Both inline borders contain two parallel lines separated by a gap.

Groove

.groove-panel {
  border-inline: 6px groove #1769aa;
}

The borders use a grooved appearance.

Ridge

.ridge-panel {
  border-inline: 6px ridge #1769aa;
}

The borders use a raised ridge appearance.

Inset

.inset-panel {
  border-inline: 6px inset #1769aa;
}

The borders use inset-style shading.

Outset

.outset-panel {
  border-inline: 6px outset #1769aa;
}

The borders use outset-style shading.

none and hidden

.none-panel {
  border-inline: none;
}
.hidden-panel {
  border-inline: hidden;
}

Both values prevent visible borders. The hidden style also has special behavior in collapsed table-border conflict resolution.

Style Longhand

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

The inline-start border is dashed, while the inline-end border is solid.

Border Color

The color component determines the color of both inline borders.

Named Color

.panel {
  border-inline: 4px solid blue;
}

Both inline borders are blue.

Hexadecimal Color

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

The borders use the specified hexadecimal color.

RGB Color

.panel {
  border-inline: 4px solid rgb(23 105 170);
}

The borders use an RGB color value.

Transparent Color

.panel {
  border-inline: 4px solid transparent;
}

The borders reserve layout space but are visually transparent.

currentColor

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

The borders use the element's current text color.

Color Longhand

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

The inline-start border is blue, while the inline-end border is green.

Color Inheritance

The border color components are not inherited. However, their initial value is currentcolor, which follows the element's computed color value.

Use border-inline-color when the border colors need to change without modifying their widths or styles.

Inline Start and End

The border-inline shorthand assigns identical border values to the logical inline-start and inline-end sides.

Equivalent Individual Shorthands

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

These declarations are equivalent to border-inline: 4px solid #1769aa;.

Different Start and End Borders

.panel {
  border-inline-start: 6px solid #1769aa;
  border-inline-end: 2px dashed #27ae60;
}

The inline-start and inline-end borders use different widths, styles, and colors.

Override One Side

.panel {
  border-inline: 4px solid #1769aa;
  border-inline-end: 8px double #27ae60;
}

Both inline borders are initially blue and solid. The later declaration changes only the inline-end border.

Shorthand After Individual Properties

.panel {
  border-inline-start: 6px dashed #27ae60;
  border-inline: 4px solid #1769aa;
}

The later border-inline shorthand replaces the earlier inline-start border settings.

Start and End Component Properties

.panel {
  border-inline-start-width: 6px;
  border-inline-start-style: solid;
  border-inline-start-color: #1769aa;
  border-inline-end-width: 2px;
  border-inline-end-style: dashed;
  border-inline-end-color: #27ae60;
}

Each logical side can also be controlled using its individual width, style, and color properties.

Use border-inline when both sides should match. Use the individual start and end properties when the sides need different appearances.

Logical vs. Physical Borders

Physical border properties target fixed sides of an element. Logical border properties target sides determined by the writing mode and text direction.

Property Targets Writing-Mode Aware
border-left Physical left side No
border-right Physical right side No
border-inline-start Logical inline-start side Yes
border-inline-end Logical inline-end side Yes
border-inline Both logical inline sides Yes

Physical Borders

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

The borders always appear on the physical left and right sides.

Logical Borders

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

The borders follow the inline axis of the writing mode.

Horizontal Writing Mode

.panel {
  writing-mode: horizontal-tb;
  border-inline: 4px solid #1769aa;
}

In this writing mode, the logical borders appear on the left and right.

Vertical Writing Mode

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

In this writing mode, the logical borders appear on the top and bottom.

Avoiding Conflicting Declarations

.panel {
  border-left: 2px solid #27ae60;
  border-inline: 4px solid #1769aa;
}

In a horizontal writing mode, these declarations can target the same physical left border. The cascade determines which component values apply.

For predictable results, avoid mixing logical and physical border declarations that target the same edge unless the override is intentional.

border-inline vs. border-block

The border-inline and border-block properties style different logical axes.

Property Logical Edges Horizontal Writing Mode
border-inline Inline-start and inline-end Left and right
border-block Block-start and block-end Top and bottom

Inline Borders

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

Both logical inline edges receive blue borders.

Block Borders

.panel {
  border-block: 4px solid #27ae60;
}

Both logical block edges receive green borders.

Combining Both Axes

.panel {
  border-inline: 4px solid #1769aa;
  border-block: 2px dashed #27ae60;
}

The inline edges use solid blue borders, while the block edges use dashed green borders.

Vertical Writing Mode

.panel {
  writing-mode: vertical-rl;
  border-inline: 4px solid #1769aa;
  border-block: 2px dashed #27ae60;
}

The inline borders move to the top and bottom, while the block borders appear on the left and right.

Use both properties when the element needs distinct borders along its logical inline and block axes.

Shorthand and Longhands

The border-inline shorthand sets six individual border components.

Affected Longhand Properties

Longhand Property Purpose
border-inline-start-width Inline-start border thickness
border-inline-start-style Inline-start border style
border-inline-start-color Inline-start border color
border-inline-end-width Inline-end border thickness
border-inline-end-style Inline-end border style
border-inline-end-color Inline-end border color

Shorthand Declaration

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

Equivalent Component Declarations

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

Both approaches assign the same width, style, and color to each logical inline edge.

Resetting Omitted Components

.panel {
  border-inline: 6px dashed #27ae60;
  border-inline: solid;
}

The second declaration resets the widths to medium and the colors to currentcolor, while setting both styles to solid.

Changing Only the Color

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

The later color longhand changes both border colors without resetting their widths or styles.

Changing Only One Side

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

Only the inline-end color changes.

Use the shorthand for concise declarations and the longhands when individual components require independent control.

Layout and Box Model

Inline borders are part of the CSS box model and contribute to the element's dimensions.

Border Space

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

With the default content-box sizing, the two inline borders add to the element's outer width in horizontal writing mode.

Border-Box Sizing

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

With border-box sizing, the declared width includes the padding and borders.

Padding and Inline Borders

.panel {
  padding-inline: 24px;
  border-inline: 4px solid #1769aa;
}

Logical inline padding creates space between the content and the inline borders.

Margins and Inline Borders

.panel {
  margin-inline: 20px;
  border-inline: 4px solid #1769aa;
}

Logical inline margins create space outside the element's inline borders.

Zero-Width Border

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

The borders have zero thickness and do not contribute border space.

none Border Style

.panel {
  border-inline: 4px none #1769aa;
}

Although a width is specified, the computed border width becomes zero because the style is none.

When using logical border properties, remember that the inline axis may correspond to the physical width or height depending on the writing mode.

Responsive Design

Logical borders can adapt to changes in layout, writing mode, and viewport size.

Responsive Border Width

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

The inline borders become thinner on smaller screens.

Responsive Border Color

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

The inline border color changes without modifying the width or style.

Container Query

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

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

Changing Writing Modes

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

The same logical border declaration follows the inline axis when the writing mode changes.

Fluid Border Width

.responsive-panel {
  border-inline: clamp(2px, 0.5vw, 8px) solid #1769aa;
}

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

Logical borders are particularly useful when responsive components may change orientation or support multiple writing systems.

Practical Uses

The border-inline property is useful for content panels, navigation elements, highlighted sections, and layouts that support multiple text directions.

Content Panel

.content-panel {
  padding: 24px;
  border-inline: 4px solid #1769aa;
  background-color: #f3f8fc;
}

The panel receives matching borders on both inline edges.

Highlighted Section

.highlight-section {
  padding: 20px;
  border-inline: 6px double #27ae60;
  background-color: #f4fbf6;
}

The section uses double green borders along its inline axis.

Navigation Item

.nav-item {
  padding-inline: 16px;
  border-inline: 1px solid #cccccc;
}

The navigation item receives thin borders on both inline sides.

Responsive Card

.card {
  padding: 24px;
  border-inline: 4px solid #1769aa;
  background-color: #ffffff;
}
@media (max-width: 600px) {
  .card {
    border-inline-width: 2px;
  }
}

The card's inline borders become thinner on smaller screens.

Different Start and End Colors

.accent-panel {
  padding: 24px;
  border-inline: 4px solid #1769aa;
  border-inline-end-color: #27ae60;
}

The inline-start border remains blue while the inline-end border becomes green.

Vertical Writing Panel

.vertical-panel {
  writing-mode: vertical-rl;
  padding: 20px;
  border-inline: 4px solid #1769aa;
}

The logical inline borders appear on the top and bottom of the vertically written panel.

border-inline Example

The following example demonstrates how the same border-inline declaration responds to horizontal and vertical writing modes.

<div class="border-inline-demo">
  <div class="demo-item">
    <h3>Horizontal LTR</h3>
    <div class="demo-box horizontal-ltr">Inline borders</div>
  </div>
  <div class="demo-item">
    <h3>Horizontal RTL</h3>
    <div class="demo-box horizontal-rtl">Inline borders</div>
  </div>
  <div class="demo-item">
    <h3>Vertical RL</h3>
    <div class="demo-box vertical-rl">Inline borders</div>
  </div>
</div>
.border-inline-demo {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 24px;
}
.border-inline-demo .demo-item {
  min-width: 0;
}
.border-inline-demo h3 {
  margin-bottom: 12px;
  font-size: 1rem;
}
.border-inline-demo .demo-box {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 150px;
  padding: 20px;
  border-inline: 6px solid #1769aa;
  background-color: #f3f8fc;
  color: #173b5e;
  font-weight: bold;
  text-align: center;
}
.border-inline-demo .horizontal-ltr {
  writing-mode: horizontal-tb;
  direction: ltr;
}
.border-inline-demo .horizontal-rtl {
  writing-mode: horizontal-tb;
  direction: rtl;
}
.border-inline-demo .vertical-rl {
  writing-mode: vertical-rl;
  direction: ltr;
}

Each example uses the same border declaration. Only the writing mode or text direction changes.

Browser Result

Horizontal LTR

Inline borders

Horizontal RTL

Inline borders

Vertical RL

Inline borders

The first example uses horizontal left-to-right writing, so the inline borders appear on the left and right.

The second example uses horizontal right-to-left writing. Both borders remain on the left and right because the shorthand styles both inline edges.

The third example uses vertical writing, so the inline borders appear on the top and bottom.

This demonstrates how logical border properties adapt to writing modes without requiring separate physical border declarations.

Important Considerations

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

  • Purpose: Sets the width, style, and color of both logical inline borders.
  • Shorthand: Combines six individual inline border components.
  • Inline-start: Represents the beginning edge of the inline axis.
  • Inline-end: Represents the ending edge of the inline axis.
  • Writing mode: Determines whether the inline axis runs horizontally or vertically.
  • Text direction: Determines which edge is inline-start and which is inline-end.
  • Horizontal writing: The shorthand generally styles the left and right borders.
  • Vertical writing: The shorthand styles the top and bottom borders.
  • Width: Accepts nonnegative CSS lengths or thin, medium, and thick.
  • Style: Accepts standard border styles including solid, dashed, dotted, and double.
  • Color: Accepts standard CSS color values.
  • Component order: Width, style, and color can appear in any order.
  • Omitted components: Are reset to their initial values.
  • Default style: The initial border style is none.
  • Default width: The initial border width is medium.
  • Default color: The initial border color is currentcolor.
  • Visibility: A visible border requires a style other than none or hidden.
  • Inheritance: The border components are not inherited.
  • Layout: Visible borders contribute to the element's box-model dimensions.
  • Identical sides: The shorthand assigns the same values to both inline edges.
  • Different sides: Use border-inline-start, border-inline-end, or their component longhands.
  • Physical borders: Avoid unintended conflicts with border-left, border-right, border-top, and border-bottom.
  • Block borders: Use border-block for the logical block-start and block-end edges.
  • Border images: The shorthand does not set the border-image properties.
  • Animation: Widths and colors can animate when compatible; border styles change discretely.
  • Browser support: Modern browsers support the standard property without vendor prefixes.

Use border-inline when both logical inline edges should share the same border appearance, especially in layouts that support different writing modes or text directions.

Browser Support

The border-inline 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: 4px solid #1769aa;
}

Vertical Writing Mode

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

Separate Start and End Borders

.panel {
  border-inline-start: 4px solid #1769aa;
  border-inline-end: 2px dashed #27ae60;
}

These examples use standard CSS logical border syntax.

Physical Border Fallback

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

This fallback is intended for horizontal writing modes. Older browsers receive physical left and right borders, while browsers supporting border-inline use logical borders.

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

Specifications

The border-inline 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 logical border properties map to physical edges based on writing mode and direction.

Related border width, style, and color behavior is defined in the CSS Backgrounds and Borders specification.

CSS Backgrounds and Borders Module Level 3