text-decoration Attribute | textDecoration Property

DHTML, HTML, & CSS

text-decoration Attribute | textDecoration Property


Sets or retrieves whether the text in the object has blink, line-through, overline, or underline decorations.

Syntax

HTML{ text-decoration: sDecoration }
Scriptingobject.style.textDecoration [ = sDecoration ]

Possible Values

sDecoration String that specifies one or more of the following values:
noneText has no decoration.
underline Text is underlined.
overlineText has a line over it.
line-throughText has a line drawn through it.
blinkNot implemented.

The property is read/write with a default value of none (see the Remarks section); the cascading style sheets (CSS) attribute is not inherited.

Expressions can be used in place of the preceding value(s), as of Microsoft® Internet Explorer 5. For more information, see dynamic propertiesInternet Link.

Remarks

The default value is different for the following tags:

  • Default value is underline for A when used with href, U, and INS.
  • Default value is line-through for STRIKE, S, and DEL.

If the value none is placed at the end of the values, all values are cleared. For example, setting {text-decoration: underline overline blink none} causes none of the decorations to render.

If the object has no text (for example, the IMG object in HTML) or is an empty object (for example, "<EM> </EM>"), this property has no effect.

If you set the text-decoration attribute to none on the BODY object, the A objects are still underlined. To remove the underline from the A objects, either set the style inline or use A as a selector in the global style sheet.

Specifying the textDecoration property for block elements affects all inline children. If it is specified for, or affects, an inline element, it affects all boxes generated by the element.

The overline and blink possible values are available as of Internet Explorer 4.0. Although blink is exposed, it is not rendered.

Example

The following examples use the text-decoration attribute and the textDecoration property to decorate text within the object.

This example uses an inline style sheet to draw a line through the text within the object.

Sample Code

<DIV STYLE="text-decoration:line-through">
:
</DIV>

This feature requires Internet Explorer 4.0 or later. Click the icon below to install the latest version. Then reload this page to view the sample.
Microsoft Internet Explorer

This example uses inline scripting to underline the text within the SPAN object when the user moves the mouse over the SPAN.

<SPAN STYLE="font-size:14"
onmouseover=this.style.textDecoration="underline"
:
</SPAN>

This feature requires Internet Explorer 4.0 or later. Click the icon below to install the latest version. Then reload this page to view the sample.
Microsoft Internet Explorer

Applies To

[ Object Name ]
PlatformVersion
Win16:
Win32:
Mac:
Unix:
WinCE:
Version data is listed when the mouse hovers over a link, or the link has focus.
A, ADDRESS, B, BIG, BLOCKQUOTE, BODY, BUTTON, CAPTION, CENTER, CITE, CODE, COL, COLGROUP, currentStyle, custom, DD, DFN, DIR, DIV, DL, DT, EM, FIELDSET, FORM, Hn, HTML, I, INPUT type=button, INPUT type=checkbox, INPUT type=file, INPUT type=image, INPUT type=password, INPUT type=radio, INPUT type=reset, INPUT type=submit, INPUT type=text, ISINDEX, KBD, LABEL, LEGEND, LI, LISTING, MARQUEE, MENU, OL, P, PLAINTEXT, PRE, runtimeStyle, S, SAMP, SELECT, SMALL, SPAN, STRIKE, STRONG, style, SUB, SUP, TABLE, TBODY, TD, TEXTAREA, TFOOT, TH, THEAD, TR, TT, U, UL, VAR, XMP

See Also

textDecorationLineThrough, textDecorationNone, textDecorationOverline, textDecorationUnderline


Back to topBack to top

Did you find this topic useful? Suggestions for other topics? write us!Internet Link

© 1999 microsoft corporation. all rights reserved. terms of useInternet Link.