Border-Top

Shorthand to set the 3 properties:

element { border-top: Border-top-width Border-top-style Border-top-color ;}

This shorthand is equivalent to the following:

element {
  border-top-width: thin | medium | thick | length | inherit ;
  border-top-style: style ;
  border-top-color: color ;
}

Alternatively you can choose to inherit from a parent element: border-top: inherit ;

The Border-Style property must be set for the Border-Width or Border-Color properties to have any effect.

The default property values, any value that is not specified in the shorthand will be set to the default.

  border-top-width: medium;
  border-top-style: none;
  border-top-color: 0;

Examples

Set the top border of H1 to a 2px dashed green line:

h1 {border-top: 2px dashed green;}

Set a large top border on a 0px element to create a downward pointing triangle:

.down-arr {
 width: 0px;
 height: 0px;
 border-right: 20px solid transparent;
 border-left: 20px solid transparent;
 border-top: 20px solid black;
}

Try it:

This is a sample of text with a CSS border. Each of the 4 borders can be styled separately with CSS.

Browser Support: All major browsers (CSS 1)

“I've learned that our background and circumstances may have influenced who we are, but we are responsible for who we become” ~ James Rhinehart

Related:

border-bottom - Shorthand to set all the border-bottom properties.
border-left - Shorthand to set all the border-left properties.
border-right - Shorthand to set all the border-right properties.
border - Shorthand to set all the border properties


© Copyright SS64.com 1999-2014
Some rights reserved