HTML Element Style How to - Create Editable div








Question

We would like to know how to create Editable div.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
li {<!--from   w  w  w.j av  a  2 s  . c  o  m-->
  line-height: 20px;
  font-family: Arial;
}
</style>
</head>
<body>
  <div contenteditable="true">
    <p>Test</p>
    <ul>
      <li>1</li>
      <li>2</li>
      <li>3</li>
    </ul>
  </div>
</body>
</html>

The code above is rendered as follows: