🎨 CSS border-right-style
: Styling the Right Edge with Precision
Borders can guide the eye, separate content, and add polish to layouts. The border-right-style
property in CSS allows you to define the visual style of an element’s right border — helping you fine-tune your UI down to the edge.
🧾 What is border-right-style
?
The border-right-style
property defines the line pattern or appearance of the right border of an element. It can be solid, dotted, dashed, or even 3D-looking, depending on the effect you want to achieve.
🧬 Syntax
selector {
border-right-style: none | solid | dotted | dashed | double | groove | ridge | inset | outset;
}
🔍 Available Style Values
Style | Description |
---|---|
none | No border on the right (invisible, takes up no space). |
solid | A single straight solid line. |
dotted | A dotted line made of circular dots. |
dashed | A dashed line made of short line segments. |
double | Two parallel solid lines (thicker than a regular line). |
groove | Appears carved into the page (3D inset effect). |
ridge | Appears raised from the page (3D outset effect). |
inset | Makes the element look embedded (used mostly on input elements). |
outset | Makes the element appear raised (opposite of inset ). |
🎯 Examples
1. A basic solid right border
.box {
border-right-width: 3px;
border-right-style: solid;
border-right-color: #4CAF50;
}
Creates a clean, solid green line on the right side.
2. Dotted and dashed styles
.dotted-box {
border-right: 2px dotted gray;
}
.dashed-box {
border-right: 2px dashed orange;
}
Commonly used for less intrusive visual separation or decorative effects.
3. 3D-like styles
.card {
border-right: 4px groove #888;
}
Adds a slightly inset, carved appearance to the border — best used for specific themes or vintage UIs.
🛠️ Tips for Effective Use
- Always pair with
border-right-width
to ensure visibility. - Avoid overusing 3D effects like
groove
andridge
— they can look outdated in modern UIs. - Combine with transitions and pseudo-classes (
:hover
,:focus
) for interactive feedback. - If you’re using the shorthand
border-right
, this style can be set directly inline with color and width.
✅ Browser Support
Fully supported across all major browsers, including:
- ✅ Chrome
- ✅ Firefox
- ✅ Safari
- ✅ Edge
- ✅ Internet Explorer 8+
🔚 Conclusion
The border-right-style
property lets you control the aesthetic style of the right edge of your elements. Whether you’re emphasizing side panels, highlighting active items, or adding subtle flair, it’s a valuable tool in any CSS layout strategy.