CSS Property outline








This shorthand property sets the overall outline for an element.

Summary

ItemValue
Initial value invert none medium
Inherited No.
Version CSS2
JavaScript syntax object.style.outline="#FF00FF dotted thin"
Applies to All elements.




CSS Syntax

outline: outline-color outline-style outline-width; 

Property Values

The property values are listed in the following table.

Value Description
outline-color Set the color
outline-style Set the style
outline-width Set the width
inherit Inherit the value of the outline property from the parent element

Browser compatibility

outline Yes 8.0 Yes Yes Yes




Example

An example showing how to use outline CSS property.

<!DOCTYPE html>
<html>
<head>
<style>
p{<!-- w ww  . j av  a 2  s  .  com-->
    border:1px solid red;
    outline:green dotted thick;
}
</style>
</head>

<body>
    <p>paragraph</p>
</body>
</html>

Click to view the demo