CSS border-top-style Property
Description
The border-top-style property controls how the top edge of an element's border is rendered, determining whether that edge is visible and what visual pattern it presents. It applies solely to the top side of the element's border box, so it can be used to create asymmetric borders where the top differs from the left, right, and bottom edges. Because it affects only the visual rendering of the border, its effect is most noticeable when combined with corresponding border width and color settings; where no visible style is applied, the top edge will not contribute to the element's drawn outline.
In the cascade and computed style, border-top-style interacts with shorthands and more general declarations. For example, the shorthand border-top can set the top style together with top width and top color in one declaration, while border-style can provide a quick way to set styles for all four edges at once. Individual aspects of the top border such as thickness and color are controlled separately by border-top-width and border-top-color, and the final rendered result is the combination of those three: style determines whether and how the line is drawn, width sets its extent, and color gives it hue. More specific declarations (for the top edge) will override more general ones (for all edges) according to normal CSS cascade rules.
There are a few layout and rendering contexts where the behavior of the top border requires special attention. In table layouts that use collapsing borders, the value for the top edge of a cell participates in conflict resolution with adjacent cells, so the ultimately drawn border can be selected according to table rules rather than simply taking one cell’s top setting; see border-collapse for how those rules affect adjacent edges. Also, changes to the top border’s style often require a repaint of the element and may not produce smooth visual transitions in the same way that changes to color or transform do, so if you intend to animate border changes you should test the visual effect and consider animating properties that interpolate more cleanly.
For practical use, border-top-style is a precise tool for creating separators, tabs, and subtle UI accents that rely on a single edge. When combined thoughtfully with matching widths and colors it can help establish hierarchy and rhythm in a design without altering the element’s content flow. Because a top border’s visibility depends on the combination of style, width, and color, it’s best to think of it as one component of an element’s overall edge treatment rather than a standalone visual signal.
Definition
- Initial value
- none
- Applies to
- All elements
- Inherited
- No
- Computed value
- Specified value
- Animatable
- No
- JavaScript syntax
- object.style.borderTopStyle
Interactive Demo
Syntax
border-top-style: <line-style>
Values
- noneBorder is not drawn, color and width are ignored. If the border is an image, the image layer counts but is not drawn.
- hiddenSame as none, except in terms of conflict resolution of collapsed borders. Any element with a hidden border suppresses all shared borders at that location. Borders with a style of none have the lowest priority.
- dottedA series of round dots.
- dashedA series of square-ended dashes.
- solidA single line segment.
- doubleTwo parallel solid lines with some space between them.
- grooveDisplays a border leading to a carved effect. It is the opposite of ridge.
- ridgeLooks as if it were coming out of the canvas.
- insetLooks as if the content on the inside of the border is sunken into the canvas.
- outsetLooks as if the content on the inside of the border is coming out of the canvas.
- inherit
Example
Browser Support
The following information will show you the current browser support for the CSS border-top-style property. Hover over a browser icon to see the version that first introduced support for this CSS property.
This property is supported by all modern browsers.
Desktop
Tablets & Mobile
Last updated by CSSPortal on: 1st January 2026
