Text tagged with <del> or <s>?

Asked

Viewed 190 times

2

In a price list, where there are discounts, I want to "cross out" the original value of a product and show the discounted value, something like:

inserir a descrição da imagem aqui

For that I came across the tags <del> and <s> which produce the same effect as strikethrough text:

de <del>R$100,00</del> por R$80,00 (usando DEL)
<br>
de <s>R$100,00</s> por R$80,00 (usando S)

I would like to know the semantic difference between these two tags and which one would be appropriate for the above situation?

1 answer

4


Usually the del is used to indicate that text should be deleted, most likely screen readers will ignore the content of this tag. It can be used to leave a mark for when a revision of the text is done the contents of it is removed. Interestingly, the del, other than s already gives a hint to the developer who is going to mess with the code that the text inside the tag should be deleted, briefly it indicates an edit in the text.

Source: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/del

Already the tag s in turn it indicates only that the content of the text is irrelevant, in your case it would be the appropriate tag, as it does not indicate that it is a text to be removed, but rather that it is a text that has no relevance. Despite this according to Mozilla is very likely that screen readers can not access the content of this tag.

So if the value "crossed out" is not the correct value, or is a text irrelevant from the point of view of accessibility it should be crossed out with the tag <s>.

Source: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/s

Browser other questions tagged

You are not signed in. Login or sign up in order to post.