The border-right property sets the width, style, and color of the physical right border in one shorthand rule.
01
Right Side
Physical edge.
02
Shorthand
Width, style, color.
03
solid
Common style.
04
Sidebar Dividers
Accent borders.
05
Longhands
width, style, color.
06
Classic CSS
Universal support.
Fundamentals
Definition and Usage
The border-right CSS property is a physical shorthand that sets the border on the right side of an element. It combines border-right-width, border-right-style, and border-right-color in one declaration.
Unlike logical properties such as border-inline-end, border-right always targets the physical right edge — even in RTL text. That makes it straightforward for classic LTR layouts, sidebar dividers, and right accent dividers.
💡
Beginner Tip
For multilingual layouts that must adapt to RTL, consider border-inline-end instead of border-right so the accent bar follows the reading direction.
Foundation
📝 Syntax
border-right accepts border width, style, and color like other border shorthands:
syntax.css
selector{border-right:width style color;}
Basic Example
border-right.css
.box{border-right:5px solid red;}
Syntax Rules
Sets width, style, and color for the right border side only.
Omitted components use initial values: medium, none, currentcolor.
Any valid border width, style, and color values are accepted.
Always affects the physical right side, regardless of direction or writing-mode.
Use longhands when you need to set only width, style, or color on the right side.
The default value of border-right is medium none currentcolor. No visible border appears until you set a non-none style and a width greater than zero.
Reference
💎 Property Values
Component
Example
Meaning
border-width
4px, thin, 0.25rem
Thickness of the right border
border-style
solid, dashed, dotted
How the right border is drawn
border-color
red, #2563eb, currentcolor
Color of the right border
Common Value Types
4px solidsolid right border
3px dasheddashed style
6px solidthick accent
Scope
Right Border and Text Direction
border-right always draws on the physical right side. Text direction does not move the border — compare with logical properties when building RTL layouts.
LTR (direction: ltr)
Right border on the right side
leftright
RTL (direction: rtl)
Right border still on the right side
leftright
Compare
border-right vs related properties
Property
Targets
Best for
border-right
Physical right side only
Right accent bars and trailing dividers
border-inline-end
Logical inline-end side
Direction-aware trailing borders in RTL layouts
border-left
Physical left side only
Left accent bars and LTR quote dividers
border
All four sides
Full box outlines
Preview
👀 Live Preview
A box with a blue border on the right side:
Blue border on the right side.
Uses border-right: 4px solid #2563eb;.
Hands-On
Examples Gallery
Try border-right with solid red borders, sidebar dividers, RTL comparison, and dashed styles.
📚 Basic Right Borders
Add a border on the physical right side of an element.
Example 1 — 5px Solid Red Border
Add a solid red right border on a box, matching the reference tutorial.
border-right-basic.html
<style>.box{border-right:5px solid red;padding:10px;}</style><divclass="box">
This box has a 5px solid red right border.
</div>
Right borders make simple sidebar divider accents in LTR layouts.
How It Works
A right-side border creates a vertical accent at the physical right edge. Pair it with padding so text does not touch the border line.
🎨 RTL and Style Variations
See how border-right behaves in RTL and with different styles.
Example 3 — border-right in RTL
In RTL text, border-right stays on the physical right — unlike border-inline-end.
border-right-rtl.html
<style>.rtl-box{direction:rtl;padding:0.75rem 1rem;border-right:4px solid #059669;background:#ecfdf5;}</style><divclass="rtl-box">
حد فيزيكي على اليسار
</div>
Any valid border style works on the right side. A dashed right border adds visual emphasis without a full box outline.
🧠 How border-right Works
1
You set width, style, and color
The shorthand combines all three border components for the right side in one rule.
Shorthand
2
Browser draws the right edge
border-right applies only to the physical right side of the element box.
Apply
3
Other sides stay unchanged
Top, right, and bottom borders keep their own values unless you set them separately.
Scope
=
→
Right border applied
Your element shows a styled border on the physical right edge.
Compatibility
Modern Browser Support
The border-right property is supported in all modern browsers, including Chrome, Firefox, Safari, Edge, and Opera.
✓ Baseline · Modern browsers
Physical right borders in every browser
Chrome, Edge, Firefox, Safari, and Opera have supported border-right since the earliest CSS versions.
99%Modern browser support
Google Chrome87+ · Desktop & Mobile
Full support
Mozilla Firefox66+ · Desktop & Mobile
Full support
Apple Safari14.1+ · macOS & iOS
Full support
Microsoft Edge87+ · All versions
Full support
Opera73+ · Modern versions
Full support
border-right property99% supported
Bottom line:border-right is one of the most reliable CSS border properties across all browsers.
Wrap Up
Conclusion
The border-right property controls the border on the physical right edge. Use it for sidebar dividers, trailing accents, and panel borders in classic LTR layouts.
Combine width, style, and color in one shorthand, or use border-right-width, border-right-style, and border-right-color when you need finer control.