Null
Null

Reputation: 152

contenteditable div content out of width in firefox and IE9

I want to make contenteditable div works like as it works on Chrome in firefox and chrome as if i dont hit Enter and keep pressing keys then content becomes overflow from div's width in Firefox(26 ver) and IE9 but in Chrome it automatically adjust in div's width here is my code

<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
  <style>
  div {

  width:20%;
  height:100px;
  border:1px solid;
  }
  </style>
</head>
<body>
  <div contenteditable="true"></div>   
</body>
</html>

and i have created bin here

Upvotes: 0

Views: 1461

Answers (1)

Rahil Wazir
Rahil Wazir

Reputation: 10132

You need to apply word-wrap property in css so it will work as expected.

CSS:

div {
  width:20%;
  height:100px;
  border:1px solid;
  word-wrap: break-word; /*Added property*/
}

DEMO

Upvotes: 3

Related Questions