我只能在tr里面加上样式 不能直接加在input上 
举个例子 <tr class="textclass"> <td> <input type=text /> </td> </tr> 
如何写这个textclass 能控制这个input的宽度 
我这样写的 不好用阿 
.textclass{ 
input {width:20px;} 
} 大家帮忙

解决方案 »

  1.   

    那不把页面上所有的input都加上了样式了么  我只是想 在table的某个tr里面加
    我不能在input里面写, 只能写在input所在的行---tr里面
      

  2.   

    可以这样写:
    <input style="width:20px">。
    也就是用内联样式了。
      

  3.   

    #inputwidth {width:20px;} 
    <input id="inputwidth">
      

  4.   

    可以这样写: 
    <input style="width:20px">。 
    也就是用内联样式了。==============
    这样是对的
      

  5.   

    <HTML>
     <HEAD>
      <TITLE> New Document </TITLE>
      <style type="text/css">
    .textclass{
    width:20px;

    </style>
     </HEAD> <BODY>
    <input class="textclass">
     </BODY>
    </HTML>
      

  6.   

    那你可以直接对你需要的那个tr进行长度的定义了 不需要用css。
      

  7.   


    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
     <HEAD>
      <TITLE> New Document </TITLE>
      <style>
        .textclass td input{width:200px;}
      </style>
     </HEAD> <BODY>
      <table>
    <tr class="textclass"> <td> <input type="text" /> </td> </tr> 
    </table>
     </BODY>
    </HTML>
      

  8.   

    搞不懂,要控制input的长度用CSS干嘛?那样不更麻烦吗?例如:
             <tr>
              <td width="15%">受培训企业名称:</td>
              <td width="85%"><html-el:text property="entp_name" maxlength="40" style="width:400px" /></td>
            </tr>style="width:400px" 这个不就可以直接控制嘛!简单又简洁。呵呵  个人认为~~
      

  9.   

    你直接把input的宽度设成100% 然后控制td的宽度就完了。
      

  10.   

    <input style="width:20px">。 
    这样写就是用内联样式了。
      

  11.   

    class关键是在控制input,所以应该是7楼的样式
      

  12.   

    .textclass td input {
    width: 20px;
    }