CSS border-block-start Property
The border-block-start property is a shorthand that sets the width, style, and color of an element's logical block-start border.
The physical border affected depends on the element's writing mode. In horizontal writing, the block-start border is at the top. In vertical writing, it appears on the left or right. This makes the property useful for layouts that must adapt to different writing directions without changing physical border declarations.
border-block-start Syntax
selector {
border-block-start: 4px solid #1769aa;
}
The shorthand accepts a border width, border style, and border color in any order. Each component is optional, but a visible border generally requires a style other than none or hidden.
.example-one {
border-block-start: 3px solid blue;
}
.example-two {
border-block-start: dashed red;
}
.example-three {
border-block-start: 5px dotted;
}
.example-four {
border-block-start: solid;
}
.example-five {
border-block-start: none;
}
CSS-wide keywords can also be used:
.inherited {
border-block-start: inherit;
}
.reset {
border-block-start: initial;
}
.unset {
border-block-start: unset;
}
.reverted {
border-block-start: revert;
}
.layer-reverted {
border-block-start: revert-layer;
}
CSS-wide keywords must be used as the entire shorthand value, not combined with individual width, style, or color values.
Property Values
| Component | Accepted Values | Initial Value |
|---|---|---|
| Width | thin, medium, thick, or a nonnegative CSS length |
medium |
| Style | none, hidden, solid, dashed, dotted, double, groove, ridge, inset, outset |
none |
| Color | Any supported CSS <color> value |
currentColor |
When a component is omitted, the shorthand resets that component to its initial value.
CSS-Wide Keywords
| Value | Description |
|---|---|
inherit |
Uses the parent's computed block-start border width, style, and color. |
initial |
Resets all three components to their initial values. |
unset |
Resets all three components to their initial values because the longhands are not inherited. |
revert |
Reverts the shorthand's constituent properties according to the CSS cascade origin rules. |
revert-layer |
Reverts the constituent properties according to CSS cascade layer rules. |
The shorthand itself is not inherited. Its constituent width and color properties can animate, while changes between border styles are discrete.
How It Works
The border-block-start shorthand combines three border properties into one declaration.
Setting a Complete Border
.panel {
border-block-start: 4px solid #1769aa;
}
This creates a solid blue border with a width of 4 pixels on the logical block-start side.
Omitting the Width
.panel {
border-block-start: dashed #1769aa;
}
The border uses the initial width of medium.
Omitting the Color
.panel {
color: #1769aa;
border-block-start: 3px solid;
}
The border uses currentColor, matching the element's computed text color.
Omitting the Style
.panel {
border-block-start: 5px red;
}
The omitted style resets to none. Consequently, the border is not visible and its used width is zero.
Removing the Border
.panel {
border-block-start: none;
}
This resets the block-start border to no visible border.
Writing Modes and Border Mapping
The logical block-start side is determined by the element's writing-mode.
| Writing Mode | Physical Block-Start Border |
|---|---|
horizontal-tb |
Top |
vertical-rl |
Right |
vertical-lr |
Left |
sideways-rl |
Right |
sideways-lr |
Left |
Horizontal Writing
.horizontal {
writing-mode: horizontal-tb;
border-block-start: 5px solid #1769aa;
}
The border appears along the top edge.
Vertical Right-to-Left Writing
.vertical-right {
writing-mode: vertical-rl;
border-block-start: 5px solid #1769aa;
}
The border appears along the right edge.
Vertical Left-to-Right Writing
.vertical-left {
writing-mode: vertical-lr;
border-block-start: 5px solid #1769aa;
}
The border appears along the left edge.
Text Direction
.rtl-panel {
direction: rtl;
writing-mode: horizontal-tb;
border-block-start: 5px solid #1769aa;
}
The border remains at the top. Changing direction alone does not change the block-start side in horizontal writing mode.
Constituent Longhand Properties
The border-block-start shorthand sets three longhand properties.
| Longhand Property | Purpose |
|---|---|
border-block-start-width |
Controls the thickness of the block-start border. |
border-block-start-style |
Controls the line style of the block-start border. |
border-block-start-color |
Controls the color of the block-start border. |
Shorthand Declaration
.panel {
border-block-start: 4px dashed #1769aa;
}
Equivalent Longhand Declarations
.panel {
border-block-start-width: 4px;
border-block-start-style: dashed;
border-block-start-color: #1769aa;
}
Both examples produce the same border.
Changing One Component
.panel {
border-block-start: 4px solid #1769aa;
}
.panel.highlighted {
border-block-start-color: #d35400;
}
The highlighted class changes only the color. The width and style remain unchanged.
Border Styles
The style component determines how the block-start border is drawn.
| Style | Appearance |
|---|---|
none |
No visible border. |
hidden |
No visible border, with special precedence in collapsed table borders. |
solid |
A continuous line. |
dashed |
A sequence of line segments. |
dotted |
A sequence 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. |
Comparing Common Styles
.solid {
border-block-start: 4px solid #1769aa;
}
.dashed {
border-block-start: 4px dashed #1769aa;
}
.dotted {
border-block-start: 4px dotted #1769aa;
}
.double {
border-block-start: 6px double #1769aa;
}
Dashed, dotted, and three-dimensional styles may have slightly different appearances between browsers. Double borders generally need enough width for both lines and their gap to be distinguishable.
Border Widths
The width component accepts thin, medium, thick, or a nonnegative CSS length.
Predefined Widths
.thin {
border-block-start: thin solid #1769aa;
}
.medium {
border-block-start: medium solid #1769aa;
}
.thick {
border-block-start: thick solid #1769aa;
}
The browser determines the exact thickness of the three predefined keywords.
Explicit Lengths
.pixels {
border-block-start: 4px solid #1769aa;
}
.relative {
border-block-start: 0.25rem solid #1769aa;
}
Pixel values provide a fixed CSS measurement, while rem values are relative to the root font size.
Calculated Widths
.calculated {
border-block-start: calc(2px + 0.1rem) solid #1769aa;
}
CSS math functions can calculate valid length values for the border width.
Invalid Widths
.invalid-negative {
border-block-start: -4px solid blue;
}
.invalid-percentage {
border-block-start: 10% solid blue;
}
Negative lengths and percentages are invalid border widths. Browsers ignore these declarations.
Border Colors
The color component accepts supported CSS color values, including named colors, hexadecimal notation, and color functions.
Named Color
.named {
border-block-start: 4px solid navy;
}
Hexadecimal Color
.hex {
border-block-start: 4px solid #1769aa;
}
RGB Color
.rgb {
border-block-start: 4px solid rgb(23 105 170);
}
HSL Color
.hsl {
border-block-start: 4px solid hsl(207 76% 38%);
}
Using currentColor
.matching {
color: #1769aa;
border-block-start: 4px solid currentColor;
}
The border uses the element's computed text color. This is also the default color when the shorthand omits a color.
Transparent Border
.transparent {
border-block-start: 4px solid transparent;
}
A transparent border retains its width in the box model but is not visibly painted.
Partial Transparency
.alpha {
border-block-start: 4px solid rgb(23 105 170 / 50%);
}
The alpha component allows the border color to blend with the background.
Shorthand Behavior and Resets
Because border-block-start is a shorthand, omitted components are reset to their initial values.
Resetting an Existing Color
.panel {
border-block-start-color: red;
border-block-start: 4px solid;
}
The shorthand resets the earlier red color to currentColor.
Resetting an Existing Width
.panel {
border-block-start-width: 8px;
border-block-start: solid blue;
}
The omitted width resets to medium.
Resetting an Existing Style
.panel {
border-block-start-style: dashed;
border-block-start: 4px blue;
}
The omitted style resets to none, making the border invisible.
Overriding the Shorthand
.panel {
border-block-start: 4px solid blue;
border-block-start-style: dotted;
}
The later longhand changes only the border style to dotted.
Using the border Shorthand
.panel {
border: 2px solid gray;
border-block-start: 6px dashed blue;
}
The first declaration establishes all four physical borders. The second overrides the border mapped to the logical block-start side.
These examples assume equal cascade priority. Specificity, importance, cascade layers, and declaration order can affect which values apply.
Logical vs. Physical Borders
Logical border properties adapt to writing modes, while physical border properties always target the same physical edge.
Logical Block-Start Border
.logical {
border-block-start: 4px solid #1769aa;
}
The border follows the block-start side of the element.
Physical Top Border
.physical {
border-top: 4px solid #1769aa;
}
The border always appears along the top edge, regardless of writing mode.
Comparing Writing Modes
| Writing Mode | border-block-start |
border-top |
|---|---|---|
horizontal-tb |
Top | Top |
vertical-rl |
Right | Top |
vertical-lr |
Left | Top |
Use logical borders when an element's decoration should follow the flow of its content. Use physical borders when a particular physical edge must remain fixed.
Practical Uses
The border-block-start property is useful for section accents, separators, and components that adapt to different writing modes.
Section Accent
.content-section {
border-block-start: 5px solid #1769aa;
padding-block-start: 20px;
}
A prominent border marks the beginning of a section, with padding separating the content from the border.
Subtle Divider
.section-divider {
border-block-start: 1px solid #d0d7de;
margin-block-start: 24px;
padding-block-start: 24px;
}
A thin border provides a visual separation between sections.
Dashed Separator
.related-content {
border-block-start: 2px dashed #8a99a8;
padding-block-start: 16px;
}
A dashed border can distinguish supplementary content from the main section.
Themed Component
.themed-panel {
--accent-color: #1769aa;
border-block-start: 4px solid var(--accent-color);
}
A custom property allows the accent color to be reused across multiple components.
Hover Accent
.interactive-panel {
border-block-start: 4px solid transparent;
transition: border-block-start-color 200ms ease;
}
.interactive-panel:hover {
border-block-start-color: #1769aa;
}
@media (prefers-reduced-motion: reduce) {
.interactive-panel {
transition: none;
}
}
The transparent border reserves space before hover. The transition changes only its color, avoiding a change in border thickness.
border-block-start Example
The following example demonstrates how the same border-block-start declaration appears in three writing modes.
Each box has a 7-pixel blue block-start border. Its physical position changes automatically with the writing mode.
<div class="border-block-start-demo">
<div class="demo-item">
<p>horizontal-tb</p>
<div class="demo-box horizontal">Block-start border</div>
</div>
<div class="demo-item">
<p>vertical-rl</p>
<div class="demo-box vertical-right">Block-start border</div>
</div>
<div class="demo-item">
<p>vertical-lr</p>
<div class="demo-box vertical-left">Block-start border</div>
</div>
</div>
.border-block-start-demo {
display: flex;
flex-wrap: wrap;
align-items: flex-start;
gap: 24px;
}
.border-block-start-demo .demo-item {
padding: 10px;
}
.border-block-start-demo .demo-item p {
margin-bottom: 10px;
font-weight: bold;
}
.border-block-start-demo .demo-box {
box-sizing: border-box;
inline-size: 180px;
block-size: 120px;
padding: 15px;
border-block-start: 7px solid #1769aa;
background-color: #e8f2fb;
color: #173b5e;
font-weight: bold;
text-align: center;
}
.border-block-start-demo .horizontal {
writing-mode: horizontal-tb;
}
.border-block-start-demo .vertical-right {
writing-mode: vertical-rl;
}
.border-block-start-demo .vertical-left {
writing-mode: vertical-lr;
}
horizontal-tb
vertical-rl
vertical-lr
In horizontal-tb, the blue border appears at the top.
In vertical-rl, the border appears on the right.
In vertical-lr, the border appears on the left.
The same CSS declaration works in all three writing modes because the property follows the logical block-start side.
Important Considerations
Keep the following points in mind when using border-block-start:
- Shorthand property: Sets the width, style, and color of the logical block-start border.
- Writing mode: The physical border affected depends on
writing-mode. - Horizontal writing: The block-start border is at the top.
- Vertical writing: The block-start border is on the right in
vertical-rland on the left invertical-lr. - Value order: Width, style, and color can appear in any order.
- Optional components: Omitted components reset to their initial values.
- Initial width: The default width is
medium. - Initial style: The default style is
none. - Initial color: The default color is
currentColor. - Inheritance: The constituent properties are not inherited.
- Border visibility: A visible border style and nonzero used width are needed for the border to appear.
- Width values: Negative lengths and percentages are invalid.
- Transparent colors: A transparent border can retain layout space without being visibly painted.
- Shorthand resets: Later border shorthands may override the logical block-start border.
- Longhand overrides: Use the individual width, style, or color properties to change one component.
- Logical vs. physical:
border-block-startfollows the block axis, whileborder-topalways targets the physical top. - Box model: The used border width contributes to the element's dimensions.
- Animation: Width and color can animate, while border style changes are discrete.
- Accessibility: Important information should not be communicated using border color or style alone.
Use border-block-start when a border should follow the beginning of the block flow rather than remain attached to a fixed physical edge.
Browser Support
The border-block-start property is widely supported in modern versions of Chrome, Edge, Firefox, Safari, and other major browsers.
The standard property does not require vendor prefixes. Individual CSS color functions or math functions used within the shorthand may have separate compatibility requirements.
Standard Declaration
.panel {
border-block-start: 4px solid #1769aa;
}
Physical Border Fallback
.panel {
border-top: 4px solid #1769aa;
}
@supports (border-block-start: 4px solid red) {
.panel {
border-top: 0;
border-block-start: 4px solid #1769aa;
}
}
This fallback assumes horizontal writing mode. Older browsers use the physical top border, while browsers supporting logical borders use the block-start border.
For vertical writing modes, physical fallbacks must be adapted to the appropriate left or right edge.
Visit Can I Use? to review current browser compatibility.
Specifications
The border-block-start property is defined in the CSS Logical Properties and Values Module Level 1 specification.
CSS Logical Properties and Values Module Level 1
The width, style, and color components follow the border definitions in the CSS Backgrounds and Borders Module Level 3 specification.
