🚀 LEVEL UP TO SENIOR:Unlock 500+ Advanced Practical Challenges & Exercises.
🎓 COURSERA PARTNER:Earn professional Google, Meta, and IBM certificates to supercharge your resume.
REFERENCEhtml

html Documentation

LOADING ENGINE...

<s>

AI & DATA SCIENCE // s-tag

The <s> element renders a strikethrough line through text that is no longer accurate or relevant, without saying the content was 'deleted' from a document (that's <del>).

Syntax

<p><s>$49.99</s> $29.99 today only!</p>

Deep Dive Course

**`<s>`** communicates that content is **no longer accurate or relevant** — a classic example is a crossed-out old price next to a new sale price. It's visually identical to `<del>` (both show a strikethrough line) but semantically different: `<del>` specifically represents an edit — content that was removed from a document, often paired with `<ins>` to show what replaced it. `<s>` doesn't imply any editing history, just that the content is now outdated.

1Understanding <s>

`<s>` communicates that content is no longer accurate or relevant — a classic example is a crossed-out old price next to a new sale price. It's visually identical to <del> (both show a strikethrough line) but semantically different: <del> specifically represents an edit — content that was removed from a document, often paired with <ins> to show what replaced it. <s> doesn't imply any editing history, just that the content is now outdated.

💡

For a document revision/changelog (showing what text was added or removed), use <ins>/<del>. For an outdated price, a completed task, or content no longer true, use <s>.

editor.html
<p><s>Meeting at 3 PM</s> — moved to 4 PM.</p>
localhost:3000

2Practical Example

Here is a real-world application of <s> showing how it is used in production HTML.

editor.html
<!-- A completed checklist item -->
<ul>
  <li><s>Buy groceries</s></li>
  <li>Cook dinner</li>
</ul>
localhost:3000

3Best Practices

Follow these guidelines when working with <s>:

1. Use <s> for outdated prices, completed to-do items, or facts that are no longer true

2. Use <del>/<ins> instead when specifically documenting an edit to content

3. Don't rely on <s> alone for meaning — pair it with visible context (e.g. the new price) since strikethrough alone can be missed

⚠️

Tip: For a document revision/changelog (showing what text was added or removed), use <ins>/<del>. For an outdated price, a completed task, or content no longer true, use <s>.

editor.html
<p><s>Meeting at 3 PM</s> — moved to 4 PM.</p>
localhost:3000

Examples

Example 01Basic Usage
<p><s>Meeting at 3 PM</s> — moved to 4 PM.</p>
Example 02Advanced Example
<!-- A completed checklist item -->
<ul>
  <li><s>Buy groceries</s></li>
  <li>Cook dinner</li>
</ul>

Best Practices

  • Use for outdated prices, completed to-do items, or facts that are no longer true
  • Use / instead when specifically documenting an edit to content
  • Don't rely on alone for meaning — pair it with visible context (e.g. the new price) since strikethrough alone can be missed

Interview Question

What's the difference between <s> and <del>, since browsers render them identically by default?

Hint: Think about 'no longer relevant' versus 'removed from the document as an edit'.

<s> means the content is stale or no longer accurate (an old price, a finished task) but it's still presented as part of the current document, just marked as outdated. <del> specifically represents a tracked edit — text that was deleted from the document, typically shown alongside <ins> for what replaced it, as in a diff or revision history. They render the same visually, but the semantic intent (and how tools/screen readers may treat them) differs.

Exercises

EasyPractice using <s> in a real scenario.
View Solution
<p><s>Meeting at 3 PM</s> — moved to 4 PM.</p>

Frequently Asked Questions

What's the difference between <s> and <del>, since browsers render them identically by default?

means the content is stale or no longer accurate (an old price, a finished task) but it's still presented as part of the current document, just marked as outdated. specifically represents a tracked edit — text that was deleted from the document, typically shown alongside for what replaced it, as in a diff or revision history. They render the same visually, but the semantic intent (and how tools/screen readers may treat them) differs.

Related Functions

ins-tagstrike-tag