These look the same as their real counterparts in Safari, Chrome, and Firefox. They degrade gracefully and look OK in Opera and IE9, too.
CSS
textarea {
height: 28px;
width: 400px;
}
#textarea {
-moz-appearance: textfield-multiline;
-webkit-appearance: textarea;
border: 1px solid gray;
font: medium -moz-fixed;
font: -webkit-small-control;
height: 28px;
overflow: auto;
padding: 2px;
resize: both;
width: 400px;
}
input {
margin-top: 5px;
width: 400px;
}
#input {
-moz-appearance: textfield;
-webkit-appearance: textfield;
background-color: white;
background-color: -moz-field;
border: 1px solid darkgray;
box-shadow: 1px 1px 1px 0 lightgray inset;
font: -moz-field;
font: -webkit-small-control;
margin-top: 5px;
padding: 2px 3px;
width: 398px;
}
HTML:
<textarea>I am a textarea</textarea>
<div id="textarea" contenteditable>I look like textarea</div>
<input value="I am an input" />
<div id="input" contenteditable>I look like an input</div>
Output:
========================================================
<div contenteditable style="max-height: 300px; max-width: 300px; height: auto; width: auto; border-radius: 5px 5px 5px 5px; border: solid 5px Gray; padding: 10px; overflow-y: scroll;">
Editable Div
</div>
<div contenteditable style="max-height: 300px; max-width: 300px; height: auto; width: auto; border-radius: 5px 5px 5px 5px; border: solid 5px Gray; padding: 10px; overflow-y: scroll;">
Editable Div
</div>
Live Example:
Editable Div
Comments
Post a Comment