HTML
<s>
element
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.
| 内容类别 | 措词内容 , flow content . |
|---|---|
| 准许内容 | 措词内容 . |
| Tag omission | None, both the starting and ending tag are mandatory. |
| Permitted parents | Any element that accepts 措词内容 . |
| Implicit ARIA role | 无对应角色 |
| Permitted ARIA roles | 任何 |
| DOM 接口 |
HTMLElement
|
此元素只包括 全局属性 .
Implementation note: Up to Gecko 1.9.2 inclusive, Firefox implements the
HTMLSpanElement
interface for this element.
<s>Today's Special: Salmon</s> SOLD OUT<br> <span style="text-decoration:line-through;">Today's Special: Salmon</span> SOLD OUT
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.
| 规范 | 状态 | 注释 |
|---|---|---|
|
HTML 实时标准
The definition of 's element' in that specification. |
实时标准 | |
|
HTML5
The definition of 's element' in that specification. |
推荐 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
s
|
Chrome 完整支持 Yes | Edge 完整支持 12 |
Firefox
完整支持
1
注意事项
|
IE 完整支持 Yes | Opera 完整支持 Yes | Safari 完整支持 Yes | WebView Android 完整支持 Yes | Chrome Android 完整支持 Yes | Firefox Android 完整支持 4 | Opera Android 完整支持 Yes | Safari iOS 完整支持 Yes | Samsung Internet Android 完整支持 Yes |
完整支持
见实现注意事项。
<strike>
element, alter ego of the
<s>
element is obsolete and should not be used on Web sites any more.
<del>
element is to be used instead if the data has been
deleted
.
text-decoration-line
property is to be used to achieve the former visual aspect of the
<s>
元素。