CSS Reference

"border-top-color" - css property (v. css 2)

  • Sets the color of the top border
  • To set all border equal color use 'border-color' .
  • Initial value: the value of the color property
  • The property is not inherited
  • HTML usage: all elements
  • Browsers that support the border-top-color - property :
    Internet Explorer Mozilla Firefox Opera Google Chrome Apple Safari

Possible color values:

values Comments CSS
Color name HTML and CSS color specification defines 147 color names (17 standard colors plus 130 more). You find all the named color through the drop-down selection in the color picker below. 1
rgb(r,g,b) Integer values representing a color in the form of Red Green and Blue components each with a value between 0 - 255. (rgb(255,0,0) gives a red color) 1
#value A hexadecimal value representing a color in the form of Red Green and Blue components each with a value between 00 - FF. 1
inherit Will inherit the value from parent specification. This property value is new with CSS 2. 2
Color picker:

Selected Color:

Hex:
Red:
Green:
Blue:
Hue:
Saturation:
Value:
Harmonious colors:

Property "border-top-color" example:

<!DOCTYPE HTML >
<html  >
  <head>
    <title>Test</title>
    <style type="text/css">
      .presentation {
        border-top-color: #4DFFFF;
        border-top-style:  dotted;
        border-top-width: 22px;
        width: 400px;
        }
     </style>
  </head>
  <body>
    <div class='presentation'  >The Inherit value is inherited from
          the parent specification. This property value is new
          with CSS 2.
    </div>
  </body>
</html>

Javascript access:

// To SET values ([o] is the target object)
[o].style.borderTopColor="border-top-color value"
// To GET values you must first get the computed style object
// To get that object in IE or Opera:
var cStyle=[o].currentStyle;
// To get that object in Firefox, Chrome or Safari (w3c-type):
var cStyle=window.getComputedStyle([o],null)
// To GET the property value:;
var value=cStyle.borderTopColor;
/* IE and Opera will return
   a hexa-decimal string value (ex.: #FFFFFF)
   Firefox, Chrome and Safari will return
   a rgb string value (ex.: rgb(255,255,255))
© 2010 by Finnesand Data. All rights reserved.
This site aims to provide FREE programming training and technics.
Finnesand Data as site owner gives no warranty for the correctness in the pages or source codes.
The risk of using this web-site pages or any program codes from this website is entirely at the individual user.