使用CSS和cols和rows对textarea进行大小调整 [英] sizing a textarea with CSS vs with cols and rows
问题描述
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>
推荐答案
cols
and rows
与字体大小有关。 height
和 width
不是。
cols
and rows
are relative to font size. height
and width
aren't.
编辑:说他们是相对于字体大小是有点太简单。如果明确设置,它们会考虑诸如 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屋!