What is the CSS border-top-width property?

The border-top-width property in CSSCascade Style Sheets sets the element’s width of the top border.

We should declare the border-style and border-top-style property before using the border-top-width property because the width is only changed when the element has some border.

Syntax


border-top-width: medium|thin|thick|length|initial|inherit;

Property values

  • thin: It is used to specify that the top border is thin.

  • thick: It is used to specify that the top border is thick.

  • length: It is used to define the thickness of the top border.

  • medium: It is the default value and is used to specify that the top border is medium.

  • initial: It is used to set the value to its default value.

  • inherit: It is used to inherit property from its parent value.

Code

The following is the basic HTMLHyperText Markup Language and CSS code to demonstrate the use of the border-top-width property.

Free Resources