CSS Property text-decoration








text-decoration allows certain text effects such as underlining.

Summary

ItemValue
Initial value none
Inherited No.
Version CSS1
JavaScript syntax object.style.textDecoration="overline"
Applies to All elements.

CSS Syntax

text-decoration: blink | 
                 inherit | 
                 line-through | 
                 none | 
                 overline | 
                 underline 




Property Values

The property values are listed in the following table.

ValueDescription
none a normal text. This is default
underline a line below the text
overline a line above the text
line-through a line through the text
blink a blinking text.
inherit inherit the text-decoration property from the parent element

Browser compatibility

text-decoration Yes Yes Yes Yes Yes




Example

An example showing how to use text-decoration CSS property.

<!DOCTYPE HTML>
<html>
  <head>
    <style>
        a:link, a:visited, a:hover, a:active {
          text-decoration: underline;<!--  www  .j ava  2s .c o  m-->
          color: #6A5ACD;
          background-color: transparent;
        }
     </style>    
  </head>
  <body>
    <ul>
      <li><a href="#">A</a></li>
      <li><a href="#">B</a></li>
      <li><a href="#">C</a></li>
      <li><a href="#">D</a></li>
    </ul>
  </body>
</html>

Click to view the demo