borderColor property

Specifies the border color of the object.

 

Syntax

Integer value = object.put_borderColor( v);Integer value = object.get_borderColor(* sColor);

Property values

Type: BSTR

one or more of the space-delimited values listed in Possible Values.

transparent (transparent)

Border is transparent.

color (color)

Up to four color names or RGB values in the Color Table.

String format

[ <color> | currentColor | transparent ] {1,4} | inherit

CSS information

Applies To All elements
Media visual
Inherited no
Initial Value see individual properties

Standards information

Remarks

The IHTMLCSSStyleDeclaration::borderColor property is a shorthand for the following properties:

Up to four different colors can be specified in the following order: top, right, bottom, left.

  • If one color is supplied, it is used for all four sides.
  • If two colors are supplied, the first is used for the top and bottom, and the second is used for left and right.
  • If three colors are supplied, they are used for top, right and left, and bottom, respectively.

The IHTMLCSSStyleDeclaration::borderColor property does not render if the IHTMLCSSStyleDeclaration::borderStyle property is set to none.

Some browsers do not recognize color names, but all browsers should recognize RGB color values and display them correctly.

Examples

The following example uses the IHTMLCSSStyleDeclaration::borderColor property to set the border color on different div elements.

<body>   
   <div class="green"></div>
   <div class="blue"></div>
   <div class="red"></div>
   <div class="yellow"></div>
   <div class="all"></div>
</body>

In the CSS below, the border colors for four different div elements are set using RGB, RGBA, HSL, and HSLA.

.green {
   border-color: rgb(126, 187, 65);
}
.blue {
   border-color: rgba(47, 160, 217, 0.5);
}
.red {
   border-color: hsl(12, 86%, 55%);
}
.yellow {
   border-color: hsla(42, 99%, 53%, 0.7);
}

In the CSS below, each of the sides of the border for the element is set to a different color. The first value, sets the top border color, the second value sets the right border color, the third value sets the bottom border color, and the fourth value sets the left border color.

.all {
   border-color: #EF5027 #7EBB41 #2FA0D9 #FEB912;
}

Requirements

Minimum supported client

Windows XP

Minimum supported server

Windows Server 2003

Header

Mshtml.h

IDL

Mshtml.idl

DLL

Mshtml.dll

See also

IHTMLCSSStyleDeclaration::border

IHTMLCSSStyleDeclaration::borderTopColor

IHTMLCSSStyleDeclaration::borderRightColor

IHTMLCSSStyleDeclaration::borderBottomColor

IHTMLCSSStyleDeclaration::borderLeftColor