18. del s ins Elements
Introduction
Section titled “Introduction”The <del>, <s>, and <ins> elements are used to mark changes in documents. <del> marks deleted content, <ins> marks inserted content, and <s> marks content that is no longer accurate. These elements help track document revisions and show edit history.
del Element
Section titled “del Element”Marks deleted content:
<p>This is <del>deleted text</del> remaining text.</p>With Attributes
Section titled “With Attributes”<del datetime="2024-01-15" cite="https://example.com/revision"> Deleted content</del>ins Element
Section titled “ins Element”Marks inserted content:
<p>This is <ins>newly inserted text</ins>.</p>With Attributes
Section titled “With Attributes”<ins datetime="2024-01-16" cite="https://example.com/revision"> New content</ins>s Element
Section titled “s Element”Marks strikethrough text (no longer accurate):
<p>Price: <s>$100</s> $80</p>Combined Usage
Section titled “Combined Usage”Show edits with both deletion and insertion:
<p> Original: <del>old text</del> Updated: <ins>new text</ins></p>Visual Appearance
Section titled “Visual Appearance”Browsers typically render:
<del>: Strikethrough text<ins>: Underlined text<s>: Strikethrough text
Best Practices
Section titled “Best Practices”Use del for Deletions
Section titled “Use del for Deletions”<!-- Good: Semantic deletion --><p><del>Removed content</del></p>
<!-- Avoid: Using s for deletions --><p><s>Removed content</s></p>Use ins for Additions
Section titled “Use ins for Additions”<!-- Good: Semantic insertion --><p>Content <ins>new addition</ins>.</p>