CSS outline property

CSS Outline Property

Description

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

Possible Values

  • <outline-color> − Any of the allowed values ​​for the outline-color property.
  • <outline-style> − Any allowed value for the outline-style attribute.


  • <outline-width> − Any allowed value for the outline-width property.

Applies to

All HTML elements.

DOM syntax

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

Example

Here is an 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 has a thick dashed green outline. 
</p> 
<br /> 

<p style = "outline:5px dotted rgb(13,33,232);"> 
This text has a 5x dotted blue outline. 
</p> 

</body> 
</html> 

This will produce the following result −

CSS outline property

Leave a Reply

Your email address will not be published. Required fields are marked *