CSS text-decoration property

CSS text-decoration Property

Description

The text-decoration property is used to add “decoration” to inline content.

Possible Values

  • none – Inline text should have no decoration added.
  • underline – Draws an underline below inline text.


  • overline – Draws an underline above inline text.

  • line-through – Draws a line through the middle of inline text.

  • blink – Inline text should blink, similar to the BLINK element introduced by Netscape.

Applies to

All HTML elements.

DOM Syntax

object.style.textDecoration = "underline"; 

Example

The following is an example showing how to decorate text.

Note – The blink property may not work in different browsers.

<html> 
<head> 
</head> 

<body> 
<p style = "text-decoration:underline;"> 
This will be underlined 
</p> 

<p style = "text-decoration:line-through;"> 
This will be struck through. 
</p> 

<p style = "text-decoration:overline;"> 
This will have a over line. 
</p> 

<p style = "text-decoration:blink;"> 
This text will have blinking effect 
</p> 
</body> 
</html> 

This will produce the following result −

CSS text-decoration property

Leave a Reply

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