The CSS reference

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

  • Sets the width of an outline.
  • Possible values are border-width or inherit.
  • Initial value: medium
  • The property is not inherited
  • HTML usage: All elements
  • Browsers that support the outline-width - property :
    Internet Explorer Mozilla Firefox Opera Google Chrome Apple Safari

Possible width values:

Values Comments CSS
thin, medium or thick The width of the keyword values are UA dependent, but the following holds: 'thin' <= 'medium' <= 'thick'. 1
length With this you specify a value with a unit identifier. 1
inherit Will inherit the value from parent specification. This property value is new with CSS 2. 2

Possible unit identifier:

unit identifier Comments CSS
em The relative unit 'em' is relative to the font size of the element itself. 1
ex The relative unit 'ex' is relative to the font size of the element itself. 1
px Pixels, relative to the viewing device 1
in inches -> 1 inch is equal to 2.54 centimeters. 1
cm centimeters. 1
mm millimeters. 1
pt points -> the points used by CSS2 are equal to 1/72th of an inch. 1
pc picas -> 1 pica is equal to 12 points. 1

Property "outline-width" 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-width" 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.outlineWidth="outline-width 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.outlineWidth;
/* IE and Opera will return a value in units as used with a Set. Firefox will return a calculated float value in pixel(px). Chrome or Safari will return a calculated int value in pixel(px)*/
© 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.