<del>:已删除的文本元素
<del>
HTML 元素表示已从文档中删除的文本范围。例如,这可以在渲染 "跟踪变化" 或源代码差异信息时使用。<ins>
元素可用于相反的目的:指示已添加到文档中的文本。
¥The <del>
HTML element represents a range of text that has been deleted from a document. This can be used when rendering "track changes" or source code diff information, for example. The <ins>
element can be used for the opposite purpose: to indicate text that has been added to the document.
Try it
属性
¥Attributes
该元素的属性包括 全局属性。
¥This element's attributes include the global attributes.
cite
-
解释更改的资源的 URI(例如会议纪要)。
datetime
-
此属性指示更改的时间和日期,并且必须是带有可选时间的有效日期字符串。如果该值无法解析为带有可选时间字符串的日期,则该元素没有关联的时间戳。不带时间的字符串格式参见 日期字符串。如果字符串同时包含日期和时间,则其格式将在 本地日期和时间字符串 中介绍。
无障碍
¥Accessibility
大多数屏幕阅读技术在其默认配置中均未声明 del
元素的存在。可以使用 CSS content
属性以及 ::before
和 ::after
伪元素来声明它。
¥The presence of the del
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.
del::before,
del::after {
clip-path: inset(100%);
clip: rect(1px, 1px, 1px, 1px);
height: 1px;
overflow: hidden;
position: absolute;
white-space: nowrap;
width: 1px;
}
del::before {
content: " [deletion start] ";
}
del::after {
content: " [deletion end] ";
}
一些使用屏幕阅读器的人故意禁止播放会造成额外冗长的内容。因此,重要的是不要滥用此技术,并且仅在不知道内容已被删除会对理解产生不利影响的情况下应用它。
¥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 deleted would adversely affect understanding.
示例
结果
技术总结
规范
Specification |
---|
HTML Standard # the-del-element |
浏览器兼容性
BCD tables only load in the browser