在html表中划分colspan

时间:2013-02-22 10:44:52

标签: html xhtml html-table

其实我是设计新手。我有一个html表,下面有三行描述

  1. 第1行 - 2列

  2. 第2行 - 1列

  3. 第3行 - 3列

  4. 现在我想在相同的分区中划分第三行列但无法调整colspan可以帮助我这里的一些代码是

    <table width="100%" cellpadding="5" cellspacing="0" border="1">
                    <tr>
                        <td align="left">Infodeep Technologies</td>
    
                        <td align="right">3 Minutes ago</td>
                    </tr>
    
                    <tr>
                        <td colspan="3" align="justify">Samsung pioneered the trend of
                            a new breed of devices, now more commonly known as
                            'phablets',smartphones that are (almost) nearing tablets in size.</td>
                    </tr>
                    <tr>
                        <td align="left">By panel.</td>
                        <td align="center">21.12%</td>
                        <td align="right">21 / 30</td>
                    </tr>
                </table>
    

2 个答案:

答案 0 :(得分:0)

希望这就是你想要的。

<table width="100%" cellpadding="5" cellspacing="0" border="1" >
            <tr>
                <td align="left" width = "50%">Infodeep Technologies</td>

                <td align="right" colspan = "2">3 Minutes ago</td>
            </tr>

            <tr>
                <td colspan="3" align="justify">Samsung pioneered the trend of
                    a new breed of devices, now more commonly known as
                    'phablets',smartphones that are (almost) nearing tablets in size.</td>
            </tr>
            <tr>
                <table border = "1" width = "100%" >
                 <tr>
                    <td  align="left" width = "33%"  >By panel.</td>

                    <td  align="centre"  width = "33%" >21.12%</td>
                    <td align="right"  width = "33%" >21 / 30</td>
                  </tr>
                </table>
            </tr>
        </table>

答案 1 :(得分:0)

尝试添加fixed表格布局,这应该会覆盖浏览器默认重新调整单元格大小。

<table width="100%" cellpadding="5" cellspacing="0" border="1" style="table-layout:fixed">
        <tr>
            <td align="left" width = "50%">Infodeep Technologies</td>

            <td align="right" colspan = "2">3 Minutes ago</td>
        </tr>

        <tr>
            <td colspan="3" align="justify">Samsung pioneered the trend of
                a new breed of devices, now more commonly known as
                'phablets',smartphones that are (almost) nearing tablets in size.</td>
        </tr>
        <tr>
            <td align="left" col>By panel.</td>
            <td align="center">21.12%</td>
            <td align="right">21 / 30</td>
        </tr>
    </table>