<s>
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
属性
这个元素仅仅包含 全局属性
备注:
直到 Gecko1.9.2(包含),Firefox 为这个元素实现了 HTMLSpanElement
接口。
示例
<s>Today's Special: Salmon</s> SOLD OUT<br>
<span style="text-decoration:line-through;">Today's Special:
Salmon</span> SOLD OUT
结果
~~Today's Special: Salmon~~ SOLD OUT ~~Today's Special: Salmon~~ SOLD OUT
Accessibility concerns
The presence of the s
element is not announced by most screen reading technology in its default configuration. It can be made to be announced by using the CSS content
property, along with the ::before
and ::after
pseudo-elements.
s::before, s::after { clip-path: inset(100%); clip: rect(1px, 1px, 1px, 1px); height: 1px; overflow: hidden; position: absolute; white-space: nowrap; width: 1px; } s::before { content: " [start of stricken text] "; } s::after { content: " [end of stricken text] "; }
Some people who use screen readers deliberately disable announcing content that creates extra verbosity. Because of this, it is important to not abuse this technique and only apply it in situations where not knowing content has been struck out would adversely affect understanding.
规范
Specification |
---|
HTML Standard # the-s-element |
浏览器兼容性
BCD tables only load in the browser
参见
<strike>
元素,另一个<s>
元素,已经废除并且不应再用于 Web 站点。<del>
元素用于代替,如果数据已经删除了。- CSS
text-decoration
-line-through 属性也用于为<s>
元素实现前者的视觉效果。