tags:

views:

56

answers:

3

I want to use (div) as a (textarea) element in html. Because when I used (textarea), it's width and height was not fixed. I want that when some one open my website they can write something on (div) like what peoples do in Facebook wall. In simple words I want to make wall like Facebook.

A: 
Darin Dimitrov
why not put dimensions directly on textarea ?
Gaby
@Gaby, yeah you are totally right. I update my answer.
Darin Dimitrov
A: 

With plain html you can only do a static representation of a wall. You'll need a server side language (e.g PHP) and some sort of storage for the wall comments such as files, database (e.g MySQL) etc

cherouvim
+1  A: 

Using HTML5, you can use the contenteditable attribute, e.g.

HTML

<div class="editor" contenteditable="true">
  bla bla bla
</div>

This would work how it is, but it should probably have a style, to look and behave nicer. For example:

CSS

div.editor {
  width: 200px;
  min-height: 50px;
  max-height: 100px;
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid #303030;
}

This is what Facebook actually does.

min-height is how big it will start off. Then it will extend up to 100px high, then it will start using a scroll bar, because of overflow-y: auto;.

Vincent McNabb