CSS Border-Top Property



CSS Tutorial  >  Border  >  Border-top

The border-top property defines the top border of an element. It is a shorthand that defines the style, width, and color of the top border. It is the combination of the following three properties:

  • border-top-style
  • border-top-width
  • border-top-color

It does not matter what order the values appear in. In addition, not all three values need to be present. If a value is not present, it will be set to the default. The default value for each property is as follows:

  • border-top-style: none
  • border-top-width: medium
  • border-top-color: black

Note that the default value for border-top-style is "none," so if the border-top-style is not defined in border-top, no border will appear.

Example 1: All three values are defined

CSS Declaration

width: 200px;
height: 100px;
border-top: solid 5px #60F;

results in the following

Example 2: Only two values are defined

CSS Declaration

width: 200px;
height: 100px;
border-top: green double;

results in the following:

In Example 2, the width of the top border is not defined, so it is set to the default value of "medium."

Next: CSS Border-Bottom




Copyright © 2024   1keydata.com   All Rights Reserved   Privacy Policy   About   Contact

AdBlock Detected!

Our website is made possible by displaying ads to our visitors. Please supporting us by whitelisting our website.