我有以下CSS代码:

td.tdhover input:hover,td.tdhover select:hover,td.tdhover textarea:hover{
 background: #f2f5a9;
 color:#ff0000;
}
td.tdhover select, td.tdhover input, td.tdhover textarea{
 position:relative;
 width:100%;
}
td.tdhover input.nobor,td.tdhover textarea.nobor{
 border:none;
}


然后,我有这个html:

<table border="1" style="width:100%;">
  <tr>
    <td style="width:100px;">Poll Name </td>
    <td style="width:5px;"><input type="text" class="nobor"></td>
    <td class="tdhover"><input type="text"></td>
  </tr>
</table>


它不适用于Chrome,但在IE中可以正常运行

最佳答案

A quick look at the Docs: box-sizing

DEMO

td.tdhover select,
td.tdhover input,
td.tdhover textarea{
  -webkit-box-sizing: border-box ;
     -moz-box-sizing: border-box ;
          box-sizing: border-box ;
   /*position: relative ; (OT) why this? */
   width: 100% ;
}

关于html - 定义宽度:css文件中的100%,不适用于Chrome,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/20343215/

10-13 00:16