contenteditable - HTML: HyperText Markup Language 编辑

The contenteditable global attribute is an enumerated attribute indicating if the element should be editable by the user. If so, the browser modifies its widget to allow editing.

The attribute must take one of the following values:

  • true or an empty string, which indicates that the element is editable.
  • false, which indicates that the element is not editable.

If the attribute is given without a value, like <label contenteditable>Example Label</label>, its value is treated as an empty string.

If this attribute is missing or its value is invalid, its value is inherited from its parent element: so the element is editable if its parent is editable.

Note that although it's allowed values include true and false, this attribute is an enumerated one and not a Boolean one.

You can set the color used to draw the text insertion caret with the CSS caret-color property.

Specifications

SpecificationStatusComment
HTML Living Standard
The definition of 'contenteditable' in that specification.
Living StandardNo change from latest snapshot, HTML 5.2
HTML 5.2
The definition of 'contenteditable' in that specification.
RecommendationSnapshot of HTML Living Standard, no change from HTML 5.1
HTML 5.1
The definition of 'contenteditable' in that specification.
RecommendationSnapshot of HTML Living Standard, no change from HTML5
HTML5
The definition of 'contenteditable' in that specification.
RecommendationSnapshot of HTML Living Standard, initial definition.

Browser compatibility

BCD tables only load in the browser

See also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:109 次

字数:5687

最后编辑:7 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文