What is the difference between <s>
and <del>
? I have read here that there are semantic differences between <b>
and <strong>
, does this apply to <s>
and <del>
? Additionally, how are such semantic differences, if any, interpreted by search engines and what affect would they have on rankings? Are there any other tags that affect search rankings?
<s>
and <del>
both still exist in the HTML specification.
- The
<del>
element represents a removal from the document. - The
<s>
represents contents that are no longer accurate or no longer relevant.
That is to say that they actually represent different things semantically. Specifically <del>
would be used if you had an existing document and wanted to indicate text that was in the document, but has been removed. This would be different than text in a document that is no longer accurate, but that has not been removed (you could use <s>
for that).
You should not use or depend on either for styling even though most browsers do have them strike-through by default. You should only rely on CSS for presentation.
Due to the mercurial nature of how search engines work, it's very difficult to say whether one tag or another will make a difference on how keywords are created and your content is indexed. You should focus on creating good content that is semantically correct, and your website rank will follow.
<s>
element's reference which states "The s element represents contents that are no longer accurate or no longer relevant and that therefore has been “struck” from the document." In this respect, surely <s>
and <del>
do behave in exactly the same way? –
Vannavannatta <s>
feels too much like it is simple typographic markup like <b>
. For this reason, I lean towards using <del>
. –
Hildie <s>
just what this answer quotes from an older draft, without any mention of something being “struck”. The only example is about an old retail price being mentioned in addition to new price. It is absurd to call the old price “no longer accurate or no longer relevant”, since it is mentioned specifically for comparison—it is accurate (as a fact about the past) and relevant. This shows that these “semantic” definitions and distinctions are on a thin ice. –
Cerussite DEL
in the current "living standard" is not even the usual diff sample, but something one would intuitively do with S
instead: a "done" item of a checklist (which is certainly not "removed from the document" by any means, until it is, well, actually removed...) –
Chiliasm After reading the existing answer, I left still confused about which one to use in my app. We agree that presentationally they are the same, and the difference mostly comes down to semantics. Mozilla's MDN docs helped clarify the semantics for me.
I think <s>
is correct for most use cases, and here's why along with the four relevant options:
<strike>
It's clear that
<strike>
is deprecated, and therefore not correct to use anymore.<s>
From
<s>
on MDN:The HTML Strikethrough Element (
<s>
) renders text with a strikethrough, or a line through it. Use the<s>
element to represent things that are no longer relevant or no longer accurate. However,<s>
is not appropriate when indicating document edits; for that, use the<del>
and<ins>
elements, as appropriate.**<del>
From
<del> on MDN
:The HTML Deleted Text Element (
<del>
) represents a range of text that has been deleted from a document. This element is often (but need not be) rendered with strike-through text.The biggest key to me on this page is that
<del>
, like<ins>
, offers two additional (optional) attributes:cite
anddatetime
which make sense in referring to a change in the context of a document. As a counterexample, if I were updating a restaurant menu, citing a source for a menu item being sold out doesn't seem relevant.No tag / use CSS
If none of the above seem correct for your use case, remember that you can still define a custom class.
.purchased { text-decoration: line-through; }
<p>Wish list</p> <ul> <li class="purchased">New MacBook</li> <li>Cookies</li> </ul>
There is no practical difference between del
and s
, except that the tag names are different. They have the same default rendering (overstruck text), and there is no evidence of any difference in processing by browsers or search engines, and no reason to expect such differences, since the “semantic” definitions are vague and authors don’t care much about them. There is no evidence of any action in search engines on these elements – they operate on text and usually ignore text-level markup, except possibly for some elements that might be regarded as giving their content greater relative weight within a page.
The default, or “expected” default rendering is explicitly specified in the Rendering section of HTML5 CR: del, s, strike { text-decoration: line-through; }
The theoretical difference is what HTML specifications and drafts say about their “meaning”, which varies from one HTML version to another.
So you can use either element, or neither. Overstriking text is not such a good idea, since it easily makes some letters difficult to read. But if you need to overstrike (e.g., because an ad needs to contain old price overstruck), it is perhaps safest to use strike
, which is an honest presentational element. So you avoid even the theoretical possibility that some software could interpret s
or del
in some special way, based on someone’s reading of the HTML5 CR perhaps, possibly differing from your intentions, and thus possibly causing some rendering or processing that is no consistent with your reason for overstriking. (Historically, s
and strike
have been synonymous, but HTML5 CR makes an arbitrary distinction between them, making s
“semantic” and strike
presentational.)
S
for an old price tag, but 'DEL' for an old (done) todo-item...). (NOTE: obviously, there are cases where the choice is clear, like DEL
for rendering diff outputs etc.) –
Chiliasm I would use them the way they are semantically defined: DEL for text that has been removed, and S for text that is now inaccurate but hasn't been removed.
These may mostly appear the same, but could be handled differently by screen readers and other accessibility tools - DEL may be ignored completely (eg: not read out) and S may be read out but differentiated from normal text.
© 2022 - 2024 — McMap. All rights reserved.