I want to centre the text inside a text area; I am trying with the line height, but it doesn't work.
You could use the contenteditable="true"
attribute on a <div>
and then skin it with CSS.
Here is a link for cross browser compatibility: Reliable cross-browser info on ContentEditable
You can use padding only to achieve that, but it's not pretty way to do things. You can also use jQuery to make the padding flexible, instead of just setting it by yourself.
Hey now you can used input tag
Replace textarea into input tag as like this
and define height
and line-height
Css
input[type="text"]{
line-height:125px;
height:125px;
}
HTML
<input type="text" value="">
Live demo http://jsfiddle.net/MTCrt/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.