<ins>:插入的文本元素

<ins> HTML 元素表示已添加到文档中的文本范围。你可以使用 <del> 元素来类似地表示已从文档中删除的文本范围。

¥The <ins> HTML element represents a range of text that has been added to a document. You can use the <del> element to similarly represent a range of text that has been deleted from the document.

Try it

属性

¥Attributes

该元素包括 全局属性

¥This element includes the global attributes.

cite

此属性定义解释更改的资源的 URI,例如会议纪要的链接或故障排除系统中的票证。

datetime

此属性指示更改的时间和日期,并且必须是带有可选时间字符串的有效日期。如果该值无法解析为带有可选时间字符串的日期,则该元素没有关联的时间戳。不带时间的字符串格式参见 有效日期字符串的格式。如果字符串同时包含日期和时间,则其格式将在 有效的本地日期和时间字符串的格式 中介绍。

示例

¥Examples

html
<ins>This text has been inserted</ins>

结果

¥Result

无障碍问题

¥Accessibility concerns

大多数屏幕阅读技术在其默认配置中均未声明 <ins> 元素的存在。可以使用 CSS content 属性以及 ::before::after 伪元素来声明它。

¥The presence of the <ins> 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.

css
ins::before,
ins::after {
  clip-path: inset(100%);
  clip: rect(1px, 1px, 1px, 1px);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

ins::before {
  content: " [insertion start] ";
}

ins::after {
  content: " [insertion 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 inserted would adversely affect understanding.

技术总结

¥Technical summary

内容类别 措辞内容, 流动内容.
允许的内容 透明的.
标签遗漏 无,开始和结束标记都是强制性的。
允许的父级 任何接受 措辞内容 的元素。
隐式 ARIA 角色 insertion
允许的 ARIA 角色 任何
DOM 接口 HTMLModElement

规范

Specification
HTML Standard
# the-ins-element

¥Specifications

浏览器兼容性

BCD tables only load in the browser

¥Browser compatibility

也可以看看

¥See also

  • <del> 元素用于标记文档中的删除