C and S Design.
Search Friendly Programming and Design



Styling Text - CSS Properties

CSS Text Decoration

There are 5 allowed values for the text-decoration property

Property Usage
text-decoration:value;
Demonstration text
none;
Demonstration text
overline;
Demonstration text
underline;
Demonstration text
line-through;
blink;

Value = none

No decoration is added to the text within the element this value is applied to and any decoration applied from parent elements will be removed.

Value = overline

A line above the text is applied to the element.

Value = underline

A line under the text is applied to the element.

Value = line-through

A line through the text is applied to the element.
This value is visually the same as the deprecated <strike> & <s> and the <del> HTML elements

Value = blink

The text this value is applied to blinks on & off.
Internet Explorer and Opera before Ver7 do not support this value

All these values will over-ride any text-decoration that may be applied from style definitions earlier in the document or styles applied to parent elements.

DHTML - Javascript Text Decoration

The text-decoration property can also be applied dynamically using javascript:

Scripting Syntax:
object.style.textDecoration = "underline";

NB: Hyphenated CSS properties are referenced for use with javascript by removing the hyphen and then changing the first letter after the hyphen to upper case
eg:
background-color becomes backgroundColor
margin-top becomes marginTop

Valid HTML 4.01! Valid CSS! copyright © C and S Design 2004 - 2005
Website Design and SE Friendly Coding C and S Design