How to make div for input text form?

There are some drawbacks to using textarea and input-text as input to text forms. textarea has a slightly annoying triangle in the lower right corner, and the input text is single-line.

I am trying to enter text similar to the facebook update input form. Automatically change input after line breaks. And the element or tag used was <div>. I said “used” because after they redesigned Facebook, I can’t figure out which tag is currently in use. There is a CSS property that allows the user to edit text in a div element. I actually copied the CSS property, but now I have lost it. Can someone tell me what CSS property it was? I have weak memory that it started with the -webkit prefix, although

+5
source share
4 answers

If you use html5, you can use:

<div id="divThatYouCanWriteStuffIn" contenteditable>
<!-- you can write in here -->
</div>

css:

#divThatYouCanWriteStuffIn {
    min-height: 4em; /* it should resize as required from this minimum height */
}

" " textarea s:

textarea {
  resize: none;
}

JS Fiddle .

+17

, javascript, getElementByID('mydiv').contentEditable='true';, , CSS

+1

Facebook TEXTAREA. resize:

textarea { resize:none; }

.

0

, , , p, h1, h2 ..

, .

:

textarea    {
    font-size:11px;
    font-family:Verdana, Arial, Helvetica, sans-serif;
    font-weight:normal;
    line-height:140%;
    color:black;
    margin:0 0 5px 5px;
    padding:5px;
    background-color:#999999;
    border:1px solid black;
}

. textarea .nameOfClass #nameOfId, .

, .

0

All Articles