CSS Reference

"border-color" - css property (v. css 1)

  • Sets the color of the four borders
  • This property is a shorthand property for setting 'border-top-color' , 'border-right-color' , 'border-bottom-color' and 'border-left-color' at the same place in the style sheet.
  • Initial value: The value of the 'color' property
  • The property is not inherited
  • HTML usage: all elements
  • Color can be given as a color name or as a hexadecimal value (FFFFFF - which is white)
  • Browsers that support the border-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:

You can set one to four values:

Amount of values Result of setting values
value When you specify only one value, then all the border colors will be set to this value.
value1 value2 When you specify two values, then the top and the bottom border color is set to value1 and left and right border color will be set to value2.
value1 value2 value3 When you specify three values, then the top border color will be set to value1, left and right border color will be set to value2 and the bottom border color will be set to value3.
value1 value2 value3 value4 When you specify four values, then the top border color will be set to value1, the right border color will be set to value2, the bottom border color will be set to value3 and the left border color will be set to value4.

Property "border-color" example:

<!DOCTYPE HTML >
<html  >
  <head>
    <title>Test</title>
    <style type="text/css">
      .presentation {
        border-color: #aad5ff;
        border-style: solid;    }
      table.presentation {
        border-width: 0 0 1px 1px;
        width: 500px;   }
      th.presentation, td.presentation {
        border-width: 1px 1px 0 0;
        padding: 4px 4px 4px 4px;      }
      th.presentation { background-color: #D4FFAA;}
    </style>
  </head>
  <body>
    <table class='presentation'  border='0'
           cellpadding='0' cellspacing='0' >
      <tr>
        <th class='presentation' style="width: 22%">Values</th>
        <th class='presentation'>Comments</th>
        <th class='presentation'>CSS</th>
      </tr>
      <tr>
        <td class='presentation'>thin, medium or thick</td>
        <td class='presentation'>The width of the keyword
          values are UA dependent,
          but the following holds: <b>'thin' <= 'medium'
            <= 'thick'</b>. </td>
        <td class='presentation'>1</td>
      </tr>
      <tr>
        <td class='presentation'>length</td>
        <td class='presentation'>With this you specify a
          value with a <b>unit identifier</b>. </td>
        <td class='presentation'>1</td>
      </tr>
      <tr>
        <td class='presentation'>inherit</td>
        <td class='presentation'>Will inherit the value from
          parent specification. This property value is new
          with CSS 2.</td>
        <td class='presentation'>2</td>
      </tr>
    </table>
  </body>
</html>

Javascript access:

// To SET values ([o] is the target object)
[o].style.borderColor="border-color values"
// Browsers can not return any trustworthy value from this property.
// To GET values, look at the details for each edge of the border.
© 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.