CSS Property - Border Top

Value: <border-top-width> || <border-style> || <color>
Initial: not defined for shorthand properties
Applies to: all elements
Inherited: no
Percentage values: N/A

This is a shorthand property for setting the width, style and color of an element's top border.

This property also applies to all of the following border elements:

  • border-right
  • border-bottom
  • border-left

The following CSS property rule sets the width, style and color of the border above the "P" element.

Example:

p{
border-top: 2px solid #DEDEDE;
}

This is The Result

To set the border elements individually the following example would apply:

Example:

p{
border-top: 2px solid #000000;
border-right: 4px solid #000000;
border-bottom: 6px solid #000000;
border-left: 3px solid #000000;
}

This is The Result