HTML CSS examples for CSS Property:text-decoration
The text-decoration CSS property sets the decorations for the text content.
The following table summarizes the text-decoration Property.
Item | Value |
---|---|
Default value: | none |
Applies to: | All elements |
Inherited: | No |
Animatable: | Yes, as some of the properties of the shorthand are animatable. |
The syntax of the property is as follows:
text-decoration: none | [ underline | overline | line-through | blink ] one or more values | initial | inherit
The following table describes the values of this property.
Value | Description |
---|---|
none | no text decoration. |
underline | add underline to text. |
overline | add line above text. |
line-through | add line through to text. |
blink | Makes the text blink. |
inherit | take the value of its parent element text-decoration property. |
The example below shows the text-decoration property.
<!DOCTYPE html> <html lang="en"> <head> <title>Example of CSS text-decoration property</title> <style type="text/css"> a {<!-- w w w . j a va2s .co m--> text-decoration: none; } a:hover { text-decoration: underline; } h1 { text-decoration: overline; } h2 { text-decoration: line-through; } h3 { text-decoration: underline; } h4 { text-decoration: blink; } </style> </head> <body> <h1>This is heading 1</h1> <h2>This is heading 2</h2> <h3>This is heading 3</h3> <h4>This is heading 4</h4> <p><a href="#">over me!</a></p> </body> </html>