The CSS reference
"text-decoration" - css property (v. css 1)
- To specify the decoration added to text.
- Initial value: none
- The property is not inherited
- HTML usage: all elements
-
Browsers that support the text-decoration - property :
Browser deviation:- Safari, Internet Explorer and Google chrome has not implemented the 'blink' value.
Possible text-decoration values:
value | Comments | CSS |
---|---|---|
none | Produces no text decoration. | 1 |
underline | Each line of text is underlined. Are applied only to text. Margins, borders, and padding are skipped. | 1 |
overline | Each line of text has a line above it. Are applied only to text. Margins, borders, and padding are skipped. | 1 |
line-through | Each line of text has a line through the middle. Are applied only to text. Margins, borders, and padding are skipped. | 1 |
blink | Text blinks (alternates between visible and invisible). | 1 |
inherit | Will inherit the value from parent specification. This property value is new with CSS 2. | 2 |
Property "text-decoration" example:
<!DOCTYPE HTML >
<html >
<head>
<title>Test</title>
<style type="text/css">
div {border: blue 1px solid; color:black;
padding: .5em .5em .5em .5em; width: 400px;}
.underline { text-decoration: underline; }
.line-through { text-decoration: line-through; }
.blink { text-decoration: blink; }
</style>
</head>
<body>
<br>text-decoration: underline;<br>
<div class="underline">Each line of text is underlined.
Are applied only to text. Margins, borders,
and padding are skipped.
</div>
<br> text-decoration: line-through;<br>
<div class="line-through">Each line of text has
a line through the middle.
Are applied only to text. Margins, borders,
and padding are skipped.
</div>
<br>text-decoration: blink;<br>
<div class="blink">Text blinks
(alternates between visible and invisible).
Safari, Internet Explorer and Google Chrome
has not implemented the
'blink' value.
</div>
</body>
</html>
Javascript access:
// To SET values ([o] is the target object)
[o].style.textTransform="text-transform value"
// To GET values you must first get the computed style object
// To get that object in IE or Opera:
var cStyle=[o].currentStyle;
// To get that object in Firefox, Chrome or Safari (w3c-type):
var cStyle=window.getComputedStyle([o],null)
// To GET the property value:;
var value=cStyle.textTransform;
© 2010 by Finnesand Data.
All rights reserved.
This site aims to provide FREE programming training and technics.
Finnesand Data as site owner gives no warranty for the
correctness in the pages or source codes.
The risk of using this web-site pages or any program
codes from this website is entirely at the individual user.