Colspan无法使用<td>宽度设置?(IE7)

Ale*_*lex 5 html html-table

当我使用固定宽度(IE 7)时,我无法让colspan工作?为什么?!

示例代码:

<html>
  <head>
    <style>
    .inputGroup td
    { width:250px; }    
    </style>
  </head>
<body>
<table class="inputGroup">
  <tr>
    <td>cell1</td>
    <td>cell2</td>
  </tr>
  <tr>
    <td colspan="2">This should span two columns but it doesnt</td>
  </tr>
  <tr>
    <td>cell1</td>
    <td>cell2</td>
  </tr>
</table>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

帮助任何人?:(

Luk*_*fer 7

它确实如此,但你限制了宽度.如果需要,尝试创建另一个名为".doubleSpanInputGroup"的类或宽度为500的类,并将该类设置为生成列.

例如.

<html>
  <head>
    <style>
    .inputGroup td
    { width:250px; }   
    .inputGroup td.doubleInputGroup
    { width:500px; } 
    </style>
  </head>
<body>
<table class="inputGroup">
  <tr>
    <td>cell1</td>
    <td>cell2</td>
  </tr>
  <tr>
    <td colspan="2" class="doubleInputGroup">This should span two columns but it doesnt</td>
  </tr>
  <tr>
    <td>cell1</td>
    <td>cell2</td>
  </tr>
</table>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

编辑:使新风格更加层次化