【HTML】【CSS】表格設定了table-layout:fixed後第一行合併儲存格其下儲存格寬度設定不起作用的解決方案

來源:互聯網
上載者:User
<table width="200" border="1" cellspacing="1" cellpadding="1" style="table-layout:fixed" mce_style="table-layout:fixed">  <tr>    <td width="100">1</td>    <td colspan="2">2</td>  </tr>  <tr>    <td>1.1</td>    <td width="80">2.1</td>    <td width="20">2.2</td>  </tr></table>

表格如上,當設定了style
="table-layout:fixed"
後在第一行合并了儲存格則其下面2.1、2.2的寬度設定了也不起作用。

解決辦法如下,在第一行上面再加一行,不合并,然後隱藏就好了。也就是說既然這個問題是由需合并的儲存格在第一行引起的,那麼讓需要合併儲存格的行不在第一行出現便解決了。

<table  border="1" cellspacing="1" cellpadding="1" style="table-layout:fixed;width:200px;"> <tr style="display:none" mce_style="display:none">    <td style="width:100px"></td>    <td style="width:80px"></td>    <td style="width:20px"></td>  </tr>    <tr>    <td>1</td>    <td colspan='2'>2</td>  </tr>  <tr>    <td>1.1</td>    <td>2.1</td>    <td>2.2</td>  </tr></

參見http://topic.csdn.net/u/20100908/14/8a1b21d1-e284-4eb7-866b-7f7b33a7af17.html
相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.