如何用css设置文本框的宽和高?

来源:百度知道 编辑:UC知道 时间:2024/09/21 03:22:18
呢?
一楼的同志,,,
我是用struts2做的标签,所以,想用css设置,你要是不会css就别捣乱

二楼朋友,struts2标签里不能写style,请问分开怎么写呢?绝对是可以分开写的吧。

你可以给标签家个id或class; 样式不就可以分开了?
如;
<style type="text/css">
.text1{width:100px; height:20px}
</style>
<input type="text" class="text1" />

不知道你说的是不是这意思....

首先知道不管是给div还是其他的input啊textarea元素设定宽高都是使用width和height,那么我们就可以这么做:

1、先给文本框添加个class类名【inputW】,
2、引用的css文件中写入类规则width和height
<input class="inputW" type="text" name="name" value="" />

css:
.inputW{ width:150px;/*设定宽度*/ height:32px;/*设置高度*/ line-height:32px;}
这样就可以了

<input type="text" style="width:100px; height:20px" />
style=""换成styleId="";
如果没有可以加styleClass=""这个就相当于class=""

建议你多看看html标签的书