What is the difference between and in HTML, and do they affect website rankings?

后端 未结 4 1195
长情又很酷
长情又很酷 2021-02-03 22:40

What is the difference between and ? I have read here that there are semantic differences between and

4条回答
  •  一整个雨季
    2021-02-03 23:29

    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.)

提交回复
热议问题