如何使文本区域固定为10行高度? [英] How to make text area to be height of 10 rows fixed?

查看:71
本文介绍了如何使文本区域固定为10行高度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使文本区域固定为10行高度? 我把像

How to make text area to be height of 10 rows fixed ? I put like

<label for="textarea" style="font-weight: bold;">Message Content:</label>
<br/>
<textarea cols="40" rows="10" class="ui-input-text" name="textarea" id="textarea" placeholder="Enter Message"></textarea>

但是页面加载时它的高度不是10行,并且可以调整大小.

but it is not 10 rows height when page loads and it is resizable.

推荐答案

它仅在允许调整其大小的浏览器中可调整大小.您可以使用以下CSS进行预防:

It is only resizable in browsers that allow it to be resized. You can prevent it with this CSS:

textarea
{
    resize: none;
}

关于高度不是10行,我怀疑这是因为10行高度是针对原始样式计算的,并且如果您已将样式更改为其他字体和/或字体大小,并添加了填充,可能不匹配.尝试将高度设置为10em10em +填充.

Whereas regarding the height not being 10 rows, I suspect that it is because the 10 row height is calculated for the original style and if you've changed the style to a different font and/or font-size, and added padding, it may not match. Try setting the height to, say, 10em or 10em + padding.

这篇关于如何使文本区域固定为10行高度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆