CSS Property border-top-width

border-top-width sets the width for the top border.


Initial value medium
Inherited No.
Version CSS1
JavaScript syntax object.style.borderTopWidth="thick"
Applies to All elements.

CSS Syntax

border-top-width: non-negative length | medium | thick | thin | inherit 

Property Values

The property values are listed in the following table.

Value Description
thin thin top border
medium medium top border. default
thick thick top border
length set the thickness of the top border
inherit inherit the border width from the parent element

Browser compatibility

border-top-width Yes Yes Yes Yes Yes


An example showing how to use border-top-width CSS property.

        h2 {<!--   w  ww.  j a v  a2  s.c om-->
         border-top-width: 2px;
         border-top-style: double;
  <h2>This is the title</h2>

Click to view the demo