CSS Reference

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

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

Possible border styles values:

border style Comments CSS
none No border is drawn (regardless of the 'border-width' value). 1
dotted The border is a dotted line drawn on top of the background of the element. 1
dashed The border is a dashed line drawn on top of the background of the element. 1
solid The border is a solid line. 1
double The border is a double line drawn on top of the background of the element. The sum of the two single lines and the space between equals the 'border-width' value. 1
groove A 3D groove is drawn in colors based on the <color> value. 1
ridge A 3D ridge is drawn in colors based on the <color> value. 1
inset A 3D inset is drawn in colors based on the <color> value. 1
outset A 3D outset is drawn in colors based on the <color> value. 1
inherit Will inherit the value from parent specification. This property value is new with CSS 2. 2

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 styles will be set to this value.
value1 value2 When you specify two values, then the top and the bottom border style is set to value1 and left and right border style will be set to value2.
value1 value2 value3 When you specify three values, then the top border style will be set to value1, left and right border style will be set to value2 and the bottom border style will be set to value3.
value1 value2 value3 value4 When you specify four values, then the top border style will be set to value1, the right border style will be set to value2, the bottom border style will be set to value3 and the left border style will be set to value4.

Property "outline-style" 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-style" 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.outlineStyle=outline-style 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.outlineStyle;
© 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.