CSS - outline-offset Property



Description

The outline-offset property is used to specify the space between an outline and the border edge of an element. The space between the outline and the element is transparent.

Possible Values

  • length − Any valid color value.

  • initial − Sets the value to an initial value.

  • inherit − Sets the value to the value of the parent element.

Applies to

All the HTML elements.

DOM Syntax

object.style.outlineOffset = "20px";

Example

Here is the example −

<html>
 <head>
      <style>
        div.example {
          margin: 20px;
          border: 2px dotted #000;
          background-color: #08ff90;
          outline: 4px solid #666;
          outline-offset: 10px;
        }
      </style>
 </head>
 <body>
      <h2>Outline-offset property</h2>
      <div class="example">The outline-offset is 10px</div>
 </body>
</html>
Advertisements