HTML <s> Element

Publish in HTML Tutorial el 25/05/2025 15:58

The <s> element is used to represent text that is no longer accurate or relevant, typically displayed with a strikethrough effect. Unlike <del> which indicates deleted text in a document's revision process, <s> is used for content that is no longer correct but not necessarily deleted in a formal sense.


Basic Usage

Here's how to use the <s> element in its simplest form:

When rendered, it will appear like this: This text is no longer accurate

When to Use <s>

  • To mark outdated information
  • To show prices during sales (original price strikethrough)
  • To indicate completed tasks (though <del> might be more semantic)
  • To show text that is no longer relevant but shouldn't be completely removed


Examples of <s> Element Usage

Example 1: Sale Pricing

Common e-commerce pattern showing original and sale prices:

Play Code


Example 2: Outdated Information

Showing corrected information while keeping the original (now incorrect) text:

Play Code


Example 3: Styling with CSS

Customizing the appearance of the strikethrough:

Play Code


Example 4: JavaScript Interaction (Toggle)

Using JavaScript to toggle strikethrough on click:

Play Code


Example 5: JavaScript Animation

Animating the strikethrough effect with JavaScript:

Play Code


Tips and Best Practices

  • Use <s> for stylistic strikethroughs, not for document edits (use <del> for that)
  • Consider adding ARIA attributes if the strikethrough conveys important semantic meaning
  • You can customize the strikethrough appearance with CSS
  • Don't overuse strikethrough as it can make text harder to read
  • For prices, consider pairing <s> with <ins> for the new price


Browser Support

The <s> element is supported in all modern browsers and has excellent backward compatibility.

También te puede interesar

HTML <style> Element
HTML <style> Element

The <style> HTML element contains style information for a document, or part of a document. ...

HTML <strong> Element
HTML <strong> Element

The <strong> element is used to indicate that its content has strong importance, seriousnes...

HTML <span> Element
HTML <span> Element

The <span> element is an inline container used to mark up a part of a text or document. Unl...

HTML <source> Element
HTML <source> Element

The <source> element is used to specify multiple media resources for media elements like &l...

HTML <small> Element
HTML <small> Element

The <small> element is used to represent side-comments and small print, typically for discl...

HTML <section> Element
HTML <section> Element

HTML <section> Element: The Complete Guide The <section> element is a semantic HTML ...