The border-right-width property sets how thick the right border is on an element. It is useful when you want precise control over sidebar dividers and right-edge accents.
01
Right Width
Physical right edge.
02
thin / medium / thick
Keyword sizes.
03
px / em / rem
Exact length units.
04
medium Default
Browser default size.
05
Needs Style
Pair with style/color.
06
Longhand
Part of border-right.
Fundamentals
Definition and Usage
The border-right-width CSS property allows you to specify the thickness of the right border of an element. This property is part of the border longhand family and is used to control the width of the border along the right edge.
By adjusting this property, you can enhance visual separation between elements and create more defined layouts with subtle 1px dividers or prominent accent lines.
💡
Beginner Tip
border-right-width only sets thickness. Add border-right-style: solid; and border-right-color: black; so the border is visible, or use border-right: 5px solid black; as shorthand.
Foundation
📝 Syntax
The syntax for border-right-width is straightforward. It accepts keyword values or length units.
syntax.css
selector{border-right-width:<length> | thin | medium | thick;}
The value can be a keyword such as thin or a length such as 10px, 0.25em, or 1rem.
Syntax Rules
The initial value is medium, typically around 3 to 4 pixels.
Keywords: thin, medium, and thick.
Length values use units like px, em, or rem.
Pair with border-right-style and border-right-color for full control.
Use border-right shorthand when setting width, style, and color together.
Cheat Sheet
⚡ Quick Reference
Question
Answer
Initial value
medium
Applies to
Right border width only
Inherited
No
Animatable
Yes, as a length
Common use
Sidebar dividers, right accents, emphasis lines
Defaults
Default Value
The default value of border-right-width is medium, which typically corresponds to a width of around 3 to 4 pixels depending on the browser’s default settings.
Reference
💎 Property Values
The border-right-width property accepts keyword values and length units.
Value
Description
thin
A thin border width (typically 1px)
medium
A medium border width (default, typically 3–4px)
thick
A thick border width (typically 5–6px)
<length>
A specific width using a length unit like px, em, or rem
initial
Sets the property to its default value
inherit
Inherits the property value from its parent element
previewthin
previewmedium
previewthick
preview1px
preview4px
preview8px
Scope
Right Border Width and Text Direction
border-right-width always sets the thickness of the physical right border. Text direction does not move the border — compare with border-inline-end-width when building RTL layouts.
LTR (direction: ltr)
10px right border width on the right side
leftright
RTL (direction: rtl)
Right border width still on the right side
leftright
Compare
border-right-width vs border-inline-end-width
Property
Targets
Best for
border-right-width
Physical right border thickness
Sidebar dividers, right accents, and classic LTR layouts
Trailing edge accents that follow text direction in RTL
border-right
Width, style, and color together
When you want one shorthand for the full right border
Preview
👀 Live Preview
A box with a 10px right border width:
This element has a 10px right border width.
Uses border-right-width: 10px; with solid style and black color.
Hands-On
Examples Gallery
Try border-right-width with pixel lengths, keyword sizes, width comparisons, and right-edge overrides.
📚 Basic Right Border Widths
Set the right border width with style and color longhands so the line is visible.
Example 1 — 10px Right Border Width
Set the right border width of a div to 10px, matching the reference tutorial.
border-right-width-10px.html
<style>div{border-style:solid;border-right-width:10px;border-color:black;padding:0.75rem 1rem;}</style><div>This div has a right border width of 10px.</div>
10px sets an exact thickness on the physical right edge. Style and color make the border visible.
Example 2 — thin Keyword on a Sidebar Divider
Use the thin keyword with a dashed blue right border on a sidebar panel.
border-right-width-thin.html
<style>.sidebar{border-right-width:thin;border-right-style:dashed;border-right-color:blue;padding:0.75rem 1rem;}</style><divclass="sidebar">This sidebar panel has a thin right border.</div>
The border shorthand sets all sides to 1px. border-right-width: 6px; then overrides only the right thickness for a stronger accent bar.
🧠 How border-right-width Works
1
You choose a thickness
Set a keyword like thin or a length like 10px.
Width rule
2
You add style and color
Pair the width with border-right-style and border-right-color.
Border setup
3
The browser draws the right edge
Only the physical right border uses that thickness. Top, left, and bottom sides stay unchanged.
Right edge
=
─
Sized right accent
Your element gets a clear right accent with the thickness you chose on the physical right edge.
Compatibility
Universal Browser Support
The border-right-width property is supported in all major browsers, including Chrome, Firefox, Safari, Edge, Opera, and Internet Explorer. It is one of the most reliable CSS border properties.
✓ Baseline · All browsers
Reliable right border widths on every platform
Chrome, Firefox, Safari, Edge, and Opera all support border-right-width consistently.
100%Universal support
Google Chrome69+ · Desktop & Mobile
Full support
Mozilla Firefox66+ · Desktop & Mobile
Full support
Apple Safari12.1+ · macOS & iOS
Full support
Microsoft Edge79+ · Chromium
Full support
Opera56+ · Modern versions
Full support
border-right-width property100% supported
Bottom line: Use border-right-width freely in any project. It works consistently across all browsers.
Wrap Up
Conclusion
The border-right-width property is a useful tool for controlling the thickness of the right border of elements. Whether you want a subtle 1px divider or a prominent accent line, adjusting the border width helps you achieve the desired visual effect.
Experiment with keyword values like thin and thick, or use exact lengths such as 2px and 4px to find the best fit for your design needs.
Use 1px or 2px for subtle UI dividers on the right edge
Pair width with style and color longhands for predictable results
Use rem when you want thickness to scale with root font size
Use the border-right shorthand when setting all three parts
Override only border-right-width when other sides use the border shorthand
❌ Don’t
Set width alone and forget a visible border style
Use border-right-width when you need a writing-mode-aware logical edge
Use very thick borders everywhere in minimal UI designs
Mix physical and logical width properties without a clear reason
Rely on medium when you need exact pixel control
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about border-right-width
Use these points when sizing the physical right edge.
5
Core concepts
─01
Right Width
Physical right edge.
Purpose
⚙️02
medium Default
Browser default size.
Default
📏03
thin / thick
Quick keywords.
Values
📝04
px / em / rem
Exact lengths.
Units
🔄05
One Edge Only
Other sides unchanged.
Scope
❓ Frequently Asked Questions
The border-right-width property sets the thickness of the border on the physical right side of an element only.
The initial value is medium, which is typically around 3 to 4 pixels depending on the browser.
Width alone does not always show a border. You also need a visible border-right-style such as solid and usually a color, or use the border-right shorthand.
border-right-width always sets the physical right edge thickness. border-inline-end-width follows writing direction, so it moves to the left in RTL layouts.
Length values like 2px, 4px, and 10px are common for sidebar dividers and right accents. Keywords thin, medium, and thick are useful for quick sizing.