CSS - outline


Advertisements


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;">
      This text is having thin solid red outline.
      </p>
      <br />
      
      <p style="outline:thick dashed #009900;">
      This text is having thick dashed green outline.
      </p>
      <br />
      
      <p style="outline:5px dotted rgb(13,33,232);">
      This text is having 5x dotted blue outline.
      </p>
   </body>
   
</html> 

This will produce following result −



Advertisements