CSS border-block-style Property
The border-block-style property is a shorthand that sets the line styles of an element's logical block-start and block-end borders.
It accepts one or two border style values, allowing both sides to share the same style or use different styles. The physical borders affected depend on the element's writing mode, making this property useful for layouts that adapt to horizontal and vertical text.
border-block-style Syntax
selector {
border-block-style: solid;
}
The property accepts one or two border style keywords. When two values are provided, the first applies to the block-start border and the second applies to the block-end border.
.same-style {
border-block-style: solid;
}
.different-styles {
border-block-style: dashed solid;
}
.dotted-borders {
border-block-style: dotted;
}
.double-start {
border-block-style: double solid;
}
.start-only {
border-block-style: solid none;
}
CSS-wide keywords are also supported:
.inherited {
border-block-style: inherit;
}
.reset {
border-block-style: initial;
}
.unset {
border-block-style: unset;
}
.reverted {
border-block-style: revert;
}
.layer-reverted {
border-block-style: revert-layer;
}
CSS-wide keywords must be used alone as the entire shorthand value. They cannot be combined with individual border style keywords.
Property Values
| Value | Description |
|---|---|
none |
No visible border. This is the initial style for both block sides. |
hidden |
Hides the border and has special precedence in collapsed table border conflicts. |
solid |
A continuous line. |
dashed |
A series of short line segments. |
dotted |
A series of dots. |
double |
Two parallel lines separated by a gap. |
groove |
A recessed, carved appearance. |
ridge |
A raised, embossed appearance. |
inset |
An inward, sunken appearance. |
outset |
An outward, raised appearance. |
CSS-Wide Keywords
| Keyword | Behavior |
|---|---|
inherit |
Uses the parent's computed block-start and block-end border styles. |
initial |
Resets both border styles to none. |
unset |
Resets both border styles to none because they are not inherited. |
revert |
Reverts both constituent properties according to cascade origin rules. |
revert-layer |
Reverts both constituent properties according to cascade layer rules. |
The shorthand is not inherited. Its constituent properties have an initial value of none and use discrete animation.
How It Works
The border-block-style shorthand controls how the two logical block borders are drawn. It does not change their specified widths or colors.
Setting Both Border Styles
.panel {
border-block-width: 4px;
border-block-color: #1769aa;
border-block-style: solid;
}
Both block-start and block-end borders are solid blue lines, each 4 pixels thick.
Setting Different Styles
.panel {
border-block-width: 4px;
border-block-color: #1769aa;
border-block-style: dashed solid;
}
The block-start border is dashed, while the block-end border is solid.
Changing Existing Border Styles
.panel {
border-block: 4px solid #1769aa;
border-block-style: dotted double;
}
The later declaration changes the block-start style to dotted and the block-end style to double without changing their specified widths or colors.
Style Without Width or Color
.panel {
border-block-style: dashed;
}
If no other border declarations apply, both borders use the initial width of medium and the initial color of currentColor.
Removing Both Borders
.panel {
border-block-style: none;
}
Both logical block borders have a used width of zero because their styles are none.
Writing Modes and Border Mapping
The block-start and block-end sides depend on the element's writing-mode.
| Writing Mode | Block-Start | Block-End |
|---|---|---|
horizontal-tb |
Top | Bottom |
vertical-rl |
Right | Left |
vertical-lr |
Left | Right |
sideways-rl |
Right | Left |
sideways-lr |
Left | Right |
Horizontal Writing
.horizontal {
writing-mode: horizontal-tb;
border-block: 5px #1769aa;
border-block-style: dashed solid;
}
The top border is dashed, and the bottom border is solid.
Vertical Right-to-Left Writing
.vertical-right {
writing-mode: vertical-rl;
border-block: 5px #1769aa;
border-block-style: dashed solid;
}
The right border is dashed, and the left border is solid.
Vertical Left-to-Right Writing
.vertical-left {
writing-mode: vertical-lr;
border-block: 5px #1769aa;
border-block-style: dashed solid;
}
The left border is dashed, and the right border is solid.
Text Direction
.rtl-panel {
direction: rtl;
writing-mode: horizontal-tb;
border-block: 5px #1769aa;
border-block-style: dashed solid;
}
Changing direction alone does not move the block-start or block-end borders in horizontal writing mode. They remain at the top and bottom.
One or Two Values
The number of values determines whether the logical block borders share a style or use different styles.
One Value
.panel {
border-block-style: dashed;
}
Both block-start and block-end use dashed.
Two Values
.panel {
border-block-style: dashed solid;
}
The first value applies to block-start, and the second applies to block-end.
Different Decorative Styles
.panel {
border-block-style: dotted double;
}
The block-start border is dotted, while the block-end border is double.
Only One Visible Side
.panel {
border-block-style: solid none;
}
The block-start border is solid, while the block-end border is not displayed.
Reversing the Styles
.panel {
border-block-style: none solid;
}
The block-start border is not displayed, while the block-end border is solid.
Invalid Number of Values
.invalid {
border-block-style: solid dashed dotted;
}
Three style values are invalid. Browsers ignore the entire declaration.
Available Border Styles
CSS provides ten border style keywords. The following examples use border-block-style to apply each style to both logical block borders.
Solid
.solid {
border-block: 4px #1769aa;
border-block-style: solid;
}
A continuous line suitable for section accents and component borders.
Dashed
.dashed {
border-block: 4px #1769aa;
border-block-style: dashed;
}
A broken line made of short segments.
Dotted
.dotted {
border-block: 4px #1769aa;
border-block-style: dotted;
}
A line made of dots. Dot shapes and spacing can vary between browsers.
Double
.double {
border-block: 6px #1769aa;
border-block-style: double;
}
Two parallel lines separated by a gap. The specified width includes both lines and the gap.
Groove
.groove {
border-block: 8px #1769aa;
border-block-style: groove;
}
A recessed border appearance created through shading.
Ridge
.ridge {
border-block: 8px #1769aa;
border-block-style: ridge;
}
A raised border appearance created through shading.
Inset
.inset {
border-block: 8px #1769aa;
border-block-style: inset;
}
A border that appears sunken into the surrounding surface.
Outset
.outset {
border-block: 8px #1769aa;
border-block-style: outset;
}
A border that appears raised above the surrounding surface.
The none and hidden styles suppress visible borders and are described separately below.
none and hidden
The none and hidden values both suppress border painting, but they differ when resolving collapsed table border conflicts.
Using none
.panel {
border-block-width: 5px;
border-block-style: none;
}
Both logical block borders have a used width of zero, even though their specified widths are 5 pixels.
Using hidden
.panel {
border-block-width: 5px;
border-block-style: hidden;
}
Both borders are hidden and have a used width of zero.
Hiding One Side
.panel {
border-block: 5px solid #1769aa;
border-block-style: solid none;
}
The block-start border remains visible, while the block-end border is removed.
Collapsed Table Borders
table {
border-collapse: collapse;
}
td {
border: 2px solid #1769aa;
}
td.no-divider {
border-block-style: hidden solid;
}
In the collapsed table border model, hidden suppresses competing borders along the affected edge. The none style has the lowest precedence when resolving border conflicts.
For ordinary elements, both values remove the visible border and produce a used width of zero.
Constituent Longhand Properties
The border-block-style shorthand sets two longhand properties.
| Longhand Property | Purpose |
|---|---|
border-block-start-style |
Controls the line style of the logical block-start border. |
border-block-end-style |
Controls the line style of the logical block-end border. |
Shorthand Declaration
.panel {
border-block-style: dashed solid;
}
Equivalent Longhand Declarations
.panel {
border-block-start-style: dashed;
border-block-end-style: solid;
}
Both examples assign dashed to block-start and solid to block-end.
Overriding One Side
.panel {
border-block-style: solid;
border-block-start-style: dotted;
}
The block-start border becomes dotted, while the block-end border remains solid.
Resetting Both Styles
.panel {
border-block-style: initial;
}
Both constituent longhands reset to none.
Shorthand Interactions
Other border shorthands can set or reset the styles controlled by border-block-style.
Overriding border-block
.panel {
border-block: 4px solid #1769aa;
border-block-style: dashed dotted;
}
The later declaration changes the block-start border to dashed and the block-end border to dotted.
Reset by border-block
.panel {
border-block-style: dashed dotted;
border-block: 4px solid #1769aa;
}
The later border-block shorthand replaces both styles with solid.
Using border-block-start
.panel {
border-block: 4px solid #1769aa;
border-block-style: dashed;
border-block-start: 6px double #d35400;
}
The block-start border becomes double, while the block-end border remains dashed.
Using the border Shorthand
.panel {
border-block-style: dashed;
border: 2px solid gray;
}
The later border shorthand sets all four physical border styles to solid, overriding the earlier logical styles.
Declaration Priority
These examples assume equal cascade origin, importance, specificity, and layer priority. Higher-priority declarations can override later declarations.
When mixing logical and physical border declarations, use a consistent approach and test the layout in its intended writing modes.
Logical vs. Physical Border Styles
Logical border properties follow the writing mode, while physical border properties always target fixed edges.
Logical Block Borders
.logical {
border-block-style: dashed solid;
}
The dashed and solid styles follow the logical block-start and block-end sides.
Physical Top and Bottom Borders
.physical {
border-top-style: dashed;
border-bottom-style: solid;
}
These declarations always target the physical top and bottom edges.
Comparing Writing Modes
| Writing Mode | border-block-style: dashed solid |
Physical Top and Bottom |
|---|---|---|
horizontal-tb |
Top dashed, bottom solid | Top dashed, bottom solid |
vertical-rl |
Right dashed, left solid | Top dashed, bottom solid |
vertical-lr |
Left dashed, right solid | Top dashed, bottom solid |
Use logical border styles when borders should follow the content flow. Use physical border styles when a particular physical edge must remain fixed.
Practical Uses
The border-block-style property can create consistent separators, section accents, and decorative borders along the logical block axis.
Matching Section Borders
.content-section {
border-block-width: 2px;
border-block-color: #d0d7de;
border-block-style: solid;
padding-block: 20px;
}
Both logical block borders use the same solid style.
Different Start and End Borders
.feature-panel {
border-block-width: 4px 2px;
border-block-color: #1769aa #d0d7de;
border-block-style: solid dashed;
padding-block: 16px;
}
The block-start border is a thicker solid accent, while the block-end border is a thinner dashed divider.
Decorative Section
.decorative-section {
border-block-width: 6px;
border-block-color: #1769aa;
border-block-style: double;
padding-block: 20px;
}
Double borders frame the section along the block axis.
Only a Start Border
.section-heading {
border-block-width: 4px;
border-block-color: #1769aa;
border-block-style: solid none;
padding-block-start: 12px;
}
The section heading receives a block-start accent without a block-end border.
Component Variation
.status-panel {
border-block: 3px solid #1769aa;
}
.status-panel.pending {
border-block-style: dashed;
}
The pending variation changes both border styles while preserving their specified widths and colors.
When border styles communicate a status, provide accompanying text rather than relying on the visual treatment alone.
border-block-style Example
The following example compares a single border style with two different styles and demonstrates how the same values map to horizontal and vertical writing modes.
<div class="border-block-style-demo">
<div class="demo-item">
<p>One Value</p>
<div class="demo-box same">solid</div>
</div>
<div class="demo-item">
<p>Two Values</p>
<div class="demo-box different">dashed solid</div>
</div>
<div class="demo-item">
<p>vertical-rl</p>
<div class="demo-box vertical-right">dashed solid</div>
</div>
<div class="demo-item">
<p>vertical-lr</p>
<div class="demo-box vertical-left">dashed solid</div>
</div>
</div>
.border-block-style-demo {
display: flex;
flex-wrap: wrap;
align-items: flex-start;
gap: 20px;
}
.border-block-style-demo .demo-item {
padding: 8px;
}
.border-block-style-demo .demo-item p {
margin-bottom: 10px;
font-weight: bold;
}
.border-block-style-demo .demo-box {
box-sizing: border-box;
inline-size: 170px;
block-size: 110px;
padding: 15px;
border-block-width: 6px;
border-block-color: #1769aa;
background-color: #e8f2fb;
color: #173b5e;
font-weight: bold;
text-align: center;
}
.border-block-style-demo .same {
border-block-style: solid;
}
.border-block-style-demo .different {
border-block-style: dashed solid;
}
.border-block-style-demo .vertical-right {
writing-mode: vertical-rl;
border-block-style: dashed solid;
}
.border-block-style-demo .vertical-left {
writing-mode: vertical-lr;
border-block-style: dashed solid;
}
One Value
Two Values
vertical-rl
vertical-lr
The first box uses one value, so both the top and bottom borders are solid.
The second box uses two values, creating a dashed top border and a solid bottom border.
The third box uses vertical-rl, so the right border is dashed and the left border is solid.
The fourth box uses vertical-lr, reversing the physical positions: the left border is dashed and the right border is solid.
The same border-block-style: dashed solid declaration adapts automatically to each writing mode.
Important Considerations
Keep the following points in mind when using border-block-style:
- Shorthand property: Sets the styles of the logical block-start and block-end borders.
- One value: Applies the same style to both logical block borders.
- Two values: The first applies to block-start, and the second applies to block-end.
- Initial value: Both constituent styles initially use
none. - Inheritance: The property is not inherited.
- Writing mode: The physical borders affected depend on
writing-mode. - Horizontal writing: The property controls the top and bottom border styles.
- Vertical writing: It controls the left and right border styles according to block flow.
- Available styles: Ten border style keywords are supported.
- none and hidden: Both suppress visible borders, but
hiddenhas special precedence in collapsed table border conflicts. - Used width: A border with style
noneorhiddenhas a used width of zero. - Width and color: This shorthand does not change the specified border widths or colors.
- Longhand properties: Use
border-block-start-styleorborder-block-end-styleto control one side. - Broader shorthand: Use
border-blockto set widths, styles, and colors together. - Physical borders: Logical and physical declarations may target the same edges depending on writing mode.
- Shorthand overrides: Later border shorthands may reset these styles.
- Animation: Border style changes are discrete rather than smoothly interpolated.
- Browser rendering: Dashed, dotted, and three-dimensional styles may look slightly different between browsers.
- Accessibility: Do not rely on border styles alone to communicate important information.
Use border-block-style when both logical block border styles should be managed together without resetting their widths or colors.
Browser Support
The border-block-style property is widely supported in modern versions of Chrome, Edge, Firefox, Safari, and other major browsers.
The standard property does not require vendor prefixes. The exact rendering of dashed, dotted, and three-dimensional border styles may vary slightly between browsers.
Standard Declaration
.panel {
border-block-width: 4px;
border-block-color: #1769aa;
border-block-style: dashed solid;
}
Physical Border Fallback
.panel {
border-top: 4px dashed #1769aa;
border-bottom: 4px solid #1769aa;
}
@supports (border-block-style: dashed solid) {
.panel {
border-top: 0;
border-bottom: 0;
border-block: 4px #1769aa;
border-block-style: dashed solid;
}
}
This fallback assumes horizontal writing mode. Browsers supporting logical borders use the block-start and block-end borders, while older browsers retain the physical top and bottom borders.
For vertical writing modes, physical fallbacks must be adapted to the appropriate left and right sides.
Visit Can I Use? to review current browser compatibility.
Specifications
The border-block-style property is defined in the CSS Logical Properties and Values Module Level 1 specification.
CSS Logical Properties and Values Module Level 1
The individual border style keywords and their behavior are defined in the CSS Backgrounds and Borders Module Level 3 specification.
