CSS Reference

"outline-color" - css property (v. css 2)

  • Sets the color of an outline.
  • Initial value: invert
  • The property is not inherited
  • HTML usage: All elements
  • Browsers that support the outline-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 btween 00 - FF. 1
invert 'Invert' is expected to perform a color inversion on the pixels on the screen. User agents may ignore the 'invert' value on platforms that do not support color inversion of the pixels on the screen. 2
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 "outline-color" example:

<!DOCTYPE HTML >
<html>
  <head>
    <style   type="text/css">
      .div1 { position: relative;
              width: 300px;
              top: 10px;
              left: 10px;
              outline-color: blue;
              outline-style: groove;
              outline-width: 10px;
      }
    </style>
  </head>
  <body >
    <div class="div1">
      Some text in the DIV element<br/>
      outline-color: blue;<br/>
      outline-style: groove;<br/>
      outline-width: 10px;<br/>
    </div>
  </body>
</html>

Another property "outline-color" example:

<!DOCTYPE HTML >
<html>
  <head>
    <style   type="text/css">
      .div1 { position: relative;
              height: 200px;
              width: 240px;
              outline: #0000FF 2px solid;}
      .p1 { position: relative;
            top: 10px;
            left: 10px;
            outline-color: inherit;
            outline-style:  inherit;
            outline-width:  inherit;
      }
    </style>
  </head>
  <body >
    <div class="div1">
      Some text in the DIV element
      <p class="p1" ><img width="170px" height="100px"
       src="images/ferrari.png" alt="A ferrari image">
      </p>
      The above P element inherits the
      outline of the DIV element
    </div>
  </body>
</html>

Javascript access:

// To SET values ([o] is the target object)
[o].style.outlineColor="outline-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.outlineColor;
/* 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.