Semantic Strikethroughs in XHTML

| Comments

Use the <del> tag to indicate removed content. This is semantically correct, and most browsers render it as a strikethrough.

Often the <ins> tag goes somewhere nearby, to indicate the new content that replaces the old. The W3C offers this example in the ins and del section of the the HTML 4 spec:


  A Sheriff can employ <del>3</del><ins>5</ins> deputies.
Which shows up in the browser as:

  A Sheriff can employ 35 deputies.

Today I found myself in need of a strikethrough, and the search results I got weren’t very helpful, so I wanted to get this posted for any other lost souls out there. One final, subtle point is that del should be used when you actually are removing content, and not just to get a strikethrough, though I’m hard-pressed to come up with any interpretation of the strike other than “removed”.

blog comments powered by Disqus