CSS border-top-style Property


The border-top-style CSS property is used to define the style or appearance of the top border of an element. It allows web developers to specify various border styles, such as solid lines, dashed lines, dotted lines, or even more complex patterns. By setting this property, designers can customize the visual presentation of borders on elements like divs, tables, or images, enhancing the overall aesthetics of a web page. It works in conjunction with other border-related properties like "border-top-width" and "border-top-color" to provide precise control over the top border's appearance.

Initial value
Applies to
All elements
Computed value
Specified value
JavaScript syntax

Interactive Demo

The rusty swing set creaked a lonely lullaby in the twilight, shadows lengthening like grasping fingers across the dew-kissed grass. A lone dandelion seed, adrift on the breeze, whispered secrets of faraway fields, of dandelion suns and galaxies spun from fluff. Somewhere, beyond the veil of dusk, a coyote laughed, echoing through the stillness like a forgotten memory.


border-top-style: <line-style> 


<line-style> = none | hidden | dotted | dashed | solid | double | groove | ridge | inset | outset
  • 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


<div class="border">This is an example of the border-top-style property using a red solid border 3px in width.</div>
.border {
   border: 1px solid blue;
   border-top-style: solid;
   border-top-width: 3px;
   border-top-color: red;
   margin: 20px;
   padding: 20px;

Browser Support

The following table will show you the current browser support for the CSS border-top-style property.

Edge Chrome Firefox Opera Safari
Tablets / Mobile
Chrome Firefox Opera Safari Samsung Webview

Last updated by CSSPortal on: 31st December 2023