开发者

CSS: Align a textarea inside a td

开发者 https://www.devze.com 2023-03-21 10:09 出处:网络
it\'s one of those usual table-related questions. I am trying to bloody align a textarea to be centered in atable element. It just won\'t work... I feel like I have tried everything...

it's one of those usual table-related questions. I am trying to bloody align a textarea to be centered in a table element. It just won't work... I feel like I have tried everything...

Do you need a sample code for something like this? Just imagine this:

<table>
<td><textarea></textarea></td>
</table>

The task is to align the texta开发者_运维问答rea in the center of this td.


css

textarea {
    width: 300px;
    height: 200px;
    margin: 0 auto;
    display: block;
}


only centered ?

<table>
<td valign="middle" align="center"><textarea></textarea></td>
</table>

or do you want fill the whole td ?


This should do the trick:

td {
    text-align:center;
}


set height and line-height properties. style="width: 100%;height:885px; font-family: Sans-Serif; font-size: 11px; line-height:22px; overflow: hidden; padding: 0px; margin: 0px;"

0

精彩评论

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