The border-style property defines how the border lines look on an element. It controls whether borders are solid, dashed, dotted, double, or one of several 3D-style effects.
01
All Sides
Top, right, bottom, left.
02
solid
Continuous line.
03
dashed / dotted
Soft dividers.
04
3D Styles
groove, ridge, inset.
05
none Default
No border by default.
06
Shorthand
One to four values.
Fundamentals
Definition and Usage
The border-style CSS property defines the style of the border around an element. It controls the appearance of all four sides and is essential for adding visual structure and emphasis to boxes, cards, and layout components.
By choosing different border styles such as solid, dashed, or dotted, you can create a variety of effects for cards, form fields, callouts, and decorative UI elements.
💡
Beginner Tip
A border only appears when border-style is not none. Pair it with border-width and border-color, or use border: 2px solid #000; as shorthand.
The style value refers to the border line type, such as solid, dashed, or dotted.
Syntax Rules
The initial value is none, which hides the border.
One value applies to all four sides; up to four values target top, right, bottom, and left.
Common values include solid, dashed, and dotted.
3D-style keywords include groove, ridge, inset, and outset.
Pair with border-width and border-color, or use the border shorthand.
Cheat Sheet
⚡ Quick Reference
Question
Answer
Initial value
none
Applies to
All four border sides (shorthand for top, right, bottom, left)
Inherited
No
Animatable
No
Common use
Cards, boxes, form fields, dividers, and decorative frames
Defaults
Default Value
The default value of border-style is none, meaning no border is displayed until you choose a visible style such as solid or dashed.
You can pass one to four values to style all sides at once or assign a different style to each edge.
Reference
💎 Property Values
The border-style property accepts standard CSS border style keywords.
Value
Description
none
No border is displayed
solid
A single solid line
dashed
A series of dashed lines
dotted
A series of dotted lines
double
Two solid lines with space between them
groove
A 3D grooved border that looks carved in
ridge
A 3D ridged border that looks raised out
inset
A 3D inset border that looks embedded
outset
A 3D outset border that looks raised
hidden
Same as none, but can still affect table layout
previewsolid
previewdotted
previewdashed
previewdouble
previewgroove
previewridge
previewinset
previewoutset
Shorthand
One to Four Values
border-style follows the same shorthand pattern as margin and padding. One value styles every side; up to four values target top, right, bottom, and left in that order.
One value — applies to all four sides.
Two values — first value for top and bottom, second for right and left.
Three values — top, right/left, bottom.
Four values — top, right, bottom, left.
One value (solid)
Same style on every side
Four values (solid dashed dotted double)
Different style per side
Compare
border-style vs Side Longhands vs border
Property
Targets
Best for
border-style
Style on all four sides (1–4 values)
Setting the same or mixed line styles around a box
border-top-style (and other side longhands)
Style on one physical side only
Accenting a single edge without affecting the others
border
Width, style, and color together
Quick one-line borders when all three parts are the same
Preview
👀 Live Preview
A box with a solid blue border on all sides:
This element has a solid border style.
Uses border-style: solid; with border-width and border-color longhands.
Hands-On
Examples Gallery
Try border-style with solid, dashed, dotted, double, and four-value shorthand borders.
📚 Basic Border Styles
Set border-style with width and color longhands so each line is visible, matching the reference tutorial.
Example 1 — Solid, Dashed, and Dotted Borders
Apply three different border styles to separate div elements, each with its own color.
double draws two parallel lines. A wider border width (6px here) gives enough space for both lines to appear clearly.
🧠 How border-style Works
1
You choose a line style
Set solid, dashed, dotted, or another border style keyword.
Style rule
2
You add width and color
Pair the style with border-width and border-color.
Border setup
3
The browser draws each border side
One value styles all four sides. Multiple values let you mix styles per edge.
All sides
=
⋯
Styled border frame
Your element gets a visible border that defines its shape and emphasis.
Compatibility
Universal Browser Support
The border-style 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 border styles on every platform
Chrome, Firefox, Safari, Edge, and Opera all support border-style 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-style property100% supported
Bottom line: Use border-style freely in any project. It works consistently across all browsers.
Wrap Up
Conclusion
The border-style property provides a variety of options for styling the border around an element, from simple lines to more complex effects like double and 3D styles.
By experimenting with different style keywords and shorthand values, you can enhance the visual appeal and user experience of your website with cards, form fields, callouts, and frames.
Use solid for clear boxes, cards, and form field outlines
Try dashed or dotted for softer dividers and placeholders
Use four-value shorthand when each side needs a different style
Pair style with width and color longhands for predictable results
Use the border shorthand when setting all three parts at once
Give double enough width (usually 3px or more) to show two lines
❌ Don’t
Leave the value at none and expect a visible border
Use double with a 1px width and wonder why only one line shows
Use heavy 3D styles everywhere in modern flat UI
Forget border-width when using thin styles like dotted or dashed
Mix border-style shorthand with conflicting side longhands without a plan
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about border-style
Use these points when styling borders around any element.
5
Core concepts
⋯01
All Sides
One to four values.
Purpose
—02
none Default
Hidden by default.
Default
📝03
solid / dashed
Most common styles.
Values
⚙️04
Needs Width
Pair with longhands.
Setup
🔄05
Shorthand
Per-side control.
Pattern
❓ Frequently Asked Questions
The border-style property sets the line style of the border on all four sides of an element. You can use one value for every side or up to four values for top, right, bottom, and left.
The initial value is none, which means no border is displayed until you set a visible style such as solid or dashed.
If the value is none, no border appears. You also need border-width greater than zero and usually a color, or use the border shorthand.
One value applies to all sides. Two values set top/bottom and right/left. Three values set top, right/left, and bottom. Four values set top, right, bottom, and left in that order.
solid, dashed, and dotted are the most common for boxes, cards, and dividers. double, groove, ridge, inset, and outset create stronger decorative or 3D effects.