CSS - outline



Description

The outline property is a shorthand property which is used to set the width, color, and style of an outline around an element.

Possible Values

  • <outline-color> − Any permitted value of the property outline-color.

  • <outline-style> − Any permitted value of the property outline-style.

  • <outline-width> − Any permitted value of the property outline-width.

Applies to

All the HTML elements.

DOM Syntax

object.style.outline = "thin solid red";

Example

Here is the example −

<html>
   <head>
   </head>   
   <body>
      <p style = "outline: thin solid red; padding: 10px">
         This text is having thin solid red outline.
      </p>
      <p style = "outline: thick dashed #009900; padding: 10px">
         This text is having thick dashed green outline.
      </p>
      <p style = "outline: 5px dotted rgb(13,33,232); padding: 10px">
         This text is having 5px dotted blue outline.
      </p>
   </body>
</html> 
Advertisements