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:

<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>
     

This will produce following result:

This text is having thin solid red outline.


This text is having thick dashed green outline.


This text is having 5x dotted blue outline.





Spacer Bottom Left Corner ImageBottom Right Corner Image
Valid XHTML 1.0 Strict  Valid CSS! Check the accessibility of this site according to U.S. Section 508