diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/htmlelement/contenteditable | |
parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip |
initial commit
Diffstat (limited to 'files/zh-cn/web/api/htmlelement/contenteditable')
-rw-r--r-- | files/zh-cn/web/api/htmlelement/contenteditable/index.html | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/htmlelement/contenteditable/index.html b/files/zh-cn/web/api/htmlelement/contenteditable/index.html new file mode 100644 index 0000000000..d7e96660e8 --- /dev/null +++ b/files/zh-cn/web/api/htmlelement/contenteditable/index.html @@ -0,0 +1,62 @@ +--- +title: HTMLElement.contentEditable +slug: Web/API/HTMLElement/contentEditable +translation_of: Web/API/HTMLElement/contentEditable +--- +<div> +<div> +<div>{{ APIRef("HTML DOM") }}</div> +</div> +</div> + +<h2 id="Summary" name="Summary">概述</h2> + +<p><strong><code>HTMLElement.contentEditable</code></strong> 属性用于表明元素是否是可编辑的。该枚举属性(enumerated attribute)可以具有下面的几种值之一:</p> + +<ul> + <li><code>"true"</code> 表明该元素可编辑。</li> + <li><code>"false"</code> 表明该元素不可编辑。</li> + <li><code>"inherit"</code> 表明该元素继承了其父元素的可编辑状态。</li> +</ul> + +<h2 id="Syntax" name="Syntax">语法</h2> + +<pre class="syntaxbox"><em>editable</em> = element.contentEditable +element.contentEditable = "true" +</pre> + +<h2 id="Notes" name="Notes">规范</h2> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{SpecName('HTML WHATWG', 'interaction.html#contenteditable', 'contenteditable')}}</td> + <td>{{Spec2('HTML WHATWG')}}</td> + <td> <br> + </td> + </tr> + </tbody> +</table> + +<h2 id="浏览器兼容性">浏览器兼容性</h2> + +<div> +<p>{{Compat("api.HTMLElement.contentEditable")}}</p> + +<p>在 IE 浏览器中,<code>contenteditable</code> 不能直接用在 {{htmlelement("table")}}、 {{htmlelement("col")}}、 {{htmlelement("colgroup")}}、 {{htmlelement("tbody")}}、 {{htmlelement("td")}}、 {{htmlelement("tfoot")}}、 {{htmlelement("th")}}、 {{htmlelement("thead")}} 和 {{htmlelement("tr")}} 标签上。一个可编辑的 {{htmlelement("span")}} 或者 {{htmlelement("div")}} 标签可以放在表格单元格内部。</p> +</div> + +<h2 id="相关链接">相关链接</h2> + +<ul> + <li>{{domxref("HTMLElement.isContentEditable")}}</li> + <li>全局属性 <a href="https://developer.mozilla.org/zh-CN/docs/Web/HTML/Global_attributes/contenteditable">contenteditable</a></li> + <li><a href="https://medium.com/medium-eng/why-contenteditable-is-terrible-122d8a40e480">Why ContentEditable is Terrible, Or: How the Medium Editor Works</a></li> +</ul> |