使用CSS和cols和rows对textarea进行大小调整 [英] sizing a textarea with CSS vs with cols and rows

查看:225
本文介绍了使用CSS和cols和rows对textarea进行大小调整的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

What's the difference between sizing a textarea with cols and rows and sizing a textarea with height and width?

使用cols和rows设置textarea的大小和使用height和width设置textarea的大小有什么区别? id =TextArea1cols =73rows =12> with cols rows< / textarea>
< textarea id =TextArea2style =height:200px; width:600px;> with CSS< / textarea>

<textarea id="TextArea1" cols="73" rows="12">with cols rows</textarea> <textarea id="TextArea2" style="height:200px; width:600px";>with CSS</textarea>

jsFiddle

推荐答案

cols and rows 与字体大小有关。 height width 不是。

cols and rows are relative to font size. height and width aren't.

http://jsfiddle.net/rVUEE/1/

编辑:说他们是相对于字体大小是有点太简单。如果明确设置,它们会考虑诸如 line-height letter-spacing 之类的内容。

Saying they are relative to "font size" is a bit too simplistic. They take into account things such as line-height and letter-spacing if explicitly set as well.

这篇关于使用CSS和cols和rows对textarea进行大小调整的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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