开发者

Vertically Center TextArea Text

I was wo开发者_StackOverflow中文版ndering about the textarea box bit.ly has on the 1st page you log in where they state to "Shorten your links and share from here".

I was wondering how you would go about centering text in a textarea? I don't think there's a command, so how would you hardcode move it down a few spaces. You can't use html tags in the textarea so it's been difficult with

or other methods


Are you sure it's a textarea and not just an <input type="text">? If it's the latter, you can achieve the effect quite easily with padding:

input[type=text] { font-size: 20px; padding: 5px; }

Edit: If it's a text area (say with one row), styling via padding works the same:

textarea { font-size: 20px; padding: 5px; }


Set textarea padding and margin 0 and set the line-height. Or it would be better to use padding like Kerrek posted

You can't center multi line text in a textarea but you can add padding.

<!doctype html>
<style>
input[type=text]{margin:0;padding:0;line-height:40px;font-size:40px;}
</style>
<input type=text>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜