PDA

View Full Version : xhtml compliant strike


t94xr
03-16-2005, 01:37 PM
Is there a XHTML version of <strike>?
strike is depreciated and i dont know of anything else.

Daf
03-16-2005, 01:55 PM
Hi,

Yes- it's been depreciated in favor of exporting font styling to CSS.

You can set up a class in your style sheet like so:

.strike {
text-decoration: line-through;
}

Then assign that class to the text.

Or use an inline style:

style="text-decoration: line-through"

Or use the <span> element:

<span class="strike">Text to be effected</span> (reference to the "strike" class in the css)

Daf

brothercake
03-16-2005, 02:01 PM
That's not quite true - <strike> has been superceded by a semantic deletion element <del> (which generally renders as strike-through text). There's also a companion <ins> element.

If you want it to indicate deletion, use that; if you do just want line-through text decoration, then Daf's approach is the right one.