text-decoration
Description
text-decoration
allows certain text effects such as underlining.
Item | Value |
---|---|
Initial value | none |
Inherited | No. |
Version | CSS1 |
JavaScript syntax | object.style.textDecoration="overline" |
Applies to | All elements. |
Syntax and Property Values
text-decoration: blink | //from w w w . j a v a 2 s. c om
inherit |
line-through |
none |
overline |
underline
The property values are listed in the following table.
Value | Description |
---|---|
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 |
Example
<!DOCTYPE HTML>
<html>
<head>
<style>
a:link, a:visited, a:hover, a:active {
text-decoration: underline;<!--from w w w .j av a 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>
The code above generates the following result.