欢迎来到DIVCSS5查找CSS资料与学习DIV CSS布局技术!
答案:使用HTML5contenteditable属性
您可以contenteditable使用值true(即contentEditable="true")设置HTML5属性,以使元素在HTML中可编辑,例如<div>或<p>元素。
 
让我们尝试以下示例以了解其实际工作原理:
 
例试试这个代码»
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>HTML5 Editable Elements</title>
</head>
<body>
    <h1 contentEditable="true">Your Name</h1>
    <div contentEditable="true">You Favorite Movie</div>
    <p contentEditable="true">Your Comment</p>
    <p><strong>Note:</strong> Click on the elements and type some text.</p>
</body>
</html>

如需转载,请注明文章出处和来源网址:http://www.divcss5.com/html/h61097.shtml