The border-right-color property sets the color of the border on the physical right side only.
01
Right Side
Physical color.
02
Longhand
Color only.
03
Color Formats
Hex, rgb, hsl.
04
currentcolor
Matches text.
05
Override
Recolor right only.
06
Classic CSS
Universal support.
Fundamentals
Definition and Usage
The border-right-color CSS property sets the color of the border on the physical right side of an element. It is a longhand of border-right and works alongside border-right-width and border-right-style.
Unlike logical properties such as border-inline-end-color, border-right-color always targets the physical right edge — even in RTL text. That makes it straightforward for classic LTR layouts and right accent dividers.
💡
Beginner Tip
border-right-color only sets color. Pair it with a visible border width and style, or use border: 2px solid; plus this longhand to recolor only the right side.
Foundation
📝 Syntax
border-right-color accepts any valid CSS color value:
syntax.css
selector{border-right-color:color;}
Basic Example
border-right-color.css
div{border:2px solid;border-right-color:red;}
Syntax Rules
Accepts named colors, hex, rgb, hsl, currentcolor, and transparent.
Only affects the right border side; other sides keep their own colors.
You need a visible border width and style for the color to appear.
Always affects the physical right side, regardless of direction or writing-mode.
Default is currentcolor, matching the element’s text color.
Cheat Sheet
⚡ Quick Reference
Question
Answer
Initial value
currentcolor
Applies to
Right border color only
Inherited
No
Animatable
Yes, as a color
Common use
Quote bar accents, right edge highlights, recoloring one side
Defaults
Default Value
The default value of border-right-color is currentcolor. The right border uses the element’s text color unless you set a different color explicitly.
Reference
💎 Property Values
Value
Example
Meaning
Named color
border-right-color: green;
Uses a CSS color keyword on the right side
Hex
border-right-color: #2563eb;
Hexadecimal color on the physical right side
HSL
border-right-color: hsl(142, 71%, 45%);
HSL functional notation
currentcolor
border-right-color: currentcolor;
Matches the element’s text color
transparent
border-right-color: transparent;
Makes the right border invisible
green
#2563eb
hsl
Common Value Types
greennamed color
#2563ebhex value
currentcolormatches text
Scope
Right Border Color and Text Direction
border-right-color always colors the physical right side. Text direction does not move the border — compare with border-inline-end-color when building RTL layouts.
LTR (direction: ltr)
Red right border on the right side
leftright
RTL (direction: rtl)
Right border color still on the right side
leftright
Compare
border-right-color vs related properties
Property
Targets
Best for
border-right-color
Color on the physical right side only
Right accent bars, sidebar dividers, recoloring one side
border-right
Width, style, and color on the right side
Setting the full right border in one rule
border-inline-end-color
Color on the inline-end side (direction-aware)
Trailing edge accents that follow text direction in RTL
border-right-style
Style on the physical right side only
Changing solid, dashed, or dotted on the right edge
Preview
👀 Live Preview
A box with a blue right border on a gray frame:
Blue border on the physical right side.
Uses border: 3px solid #cbd5e1; and border-right-color: #2563eb;.
Hands-On
Examples Gallery
Try border-right-color with named colors, hex values, currentcolor, and RTL text.
📚 Basic Right Border Colors
Color only the physical right border side.
Example 1 — Red Right Border Color
Change the right border color to red on a box with a visible border, matching the reference tutorial.
border-right-color-red.html
<style>div{border:2px solid;border-right-color:red;padding:10px;}</style><div>
This div has a red right border.
</div>
currentcolor is the default value. Here it makes the right border purple to match the text while other sides stay gray.
Example 4 — border-right-color in RTL
In RTL text, border-right-color stays on the physical right — unlike border-inline-end-color.
border-right-color-rtl.html
<style>.rtl-box{direction:rtl;border:3px solid #cbd5e1;border-right-color:#059669;padding:0.75rem 1rem;background:#ecfdf5;}</style><divclass="rtl-box">
حد فيزيكي على اليسار
</div>
RTL changes text flow but not the physical right edge. For a trailing accent in RTL, use border-inline-end-color instead.
🧠 How border-right-color Works
1
Border must be visible
A width and style on the right side create a border to color.
Setup
2
Color longhand applies
border-right-color sets the physical right edge color only.
Color
3
Other sides stay unchanged
Top, right, and bottom borders keep their own colors unless you override them.
Scope
=
🎨
Colored right border
Only the physical right edge shows your chosen color.
Compatibility
Modern Browser Support
The border-right-color property is supported in all modern browsers, including Chrome, Firefox, Safari, Edge, and Opera.
✓ Baseline · Modern browsers
Physical right border colors in every browser
Chrome, Edge, Firefox, Safari, and Opera have supported border-right-color 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-color property99% supported
Bottom line: Use border-right-color for reliable right-side accent colors in any modern browser.
Wrap Up
Conclusion
The border-right-color property controls the color of the physical right border. Use it for sidebar dividers, right accents, and highlights where the border should stay on the right side.
Pair it with border-right-width and border-right-style, or use the border-right shorthand when you want width, style, and color together.
Set border width and style alongside color for visible right borders
Use currentcolor when the right border should match text
Use border-right-color for classic LTR right accent dividers
Override one side after a border shorthand to recolor only the right
Use border-inline-end-color when the accent must follow text direction in RTL
❌ Don’t
Set color alone without a visible border width and style
Expect border-right-color to move to the left in RTL layouts
Mix conflicting physical and logical color rules on the same element
Use border-right-color when the design needs a trailing edge in RTL
Forget that the shorthand sets all sides before your longhand override
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about border-right-color
Use these points when coloring physical right borders.
5
Core concepts
🎨01
Right color only
Physical side.
Purpose
⚡02
currentcolor
Default.
Default
🔀03
red
Named color.
Values
🌐04
Fixed right
Not RTL-aware.
Physical
🛠05
Needs width
Color longhand.
Usage
❓ Frequently Asked Questions
The border-right-color property sets the color of the border on the physical right side of an element only.
The initial value is currentcolor, which uses the element's text color for the right border.
border-right-color always targets the physical right side, regardless of text direction or writing mode.
border-right-color only sets color. You also need a visible border width and style on the right side, or use a shorthand like border: 2px solid plus this longhand.
border-right-color is fixed to the physical right side. border-inline-end-color follows writing direction, so it moves to the left in RTL layouts.