2016-08-04 12 views
1

上午嵌套內另一個表:表的另一個表內壓扁具有麻煩

Squashed table

我想的內表以橫跨外表的整個寬度跨越。下面是生成的HTML:

<table class="table table-bordered table-striped"> 

<tr><td align="center">4 laptops were not added because they lacked unique identifiers.</td></tr> <tr><td align="center">2 laptops were not added because they already exist in the database: </td></tr><tr><td> 
    <table><th>Hostname</th><th>Asset Tag</th><th>Serial</th> 
     <tr> 
     <td></td> 
     <td></td> 
     <td>4646466</td> 
    </tr> 
     <tr> 
     <td></td> 
     <td></td> 
     <td>4646467</td> 
    </tr> 
    </table></td></tr> 
    <tr><td align="center">2 laptops were added to the database: </td></tr><tr><td> 
    <table><th>Hostname</th><th>Asset Tag</th><th>Serial</th> 
     <tr> 
     <td></td> 
     <td></td> 
     <td>4646468</td> 
    </tr> 
     <tr> 
     <td></td> 
     <td></td> 
     <td>4646469</td> 
    </tr> 
    </table></td></tr> 
</table> 

回答

1

看一看

<table class="table table-bordered table-striped" border="1"> 
 

 
<tr><td align="center">4 laptops were not added because they lacked unique identifiers.</td></tr> <tr><td align="center">2 laptops were not added because they already exist in the database: </td></tr><tr><td> 
 
    <table border="1" style="width:100%;"><th>Hostname</th><th>Asset Tag</th><th>Serial</th> 
 
     <tr> 
 
     <td></td> 
 
     <td></td> 
 
     <td>4646466</td> 
 
    </tr> 
 
     <tr> 
 
     <td></td> 
 
     <td></td> 
 
     <td>4646467</td> 
 
    </tr> 
 
    </table></td></tr> 
 
    <tr><td align="center">2 laptops were added to the database: </td></tr><tr><td> 
 
    <table><th>Hostname</th><th>Asset Tag</th><th>Serial</th> 
 
     <tr> 
 
     <td></td> 
 
     <td></td> 
 
     <td>4646468</td> 
 
    </tr> 
 
     <tr> 
 
     <td></td> 
 
     <td></td> 
 
     <td>4646469</td> 
 
    </tr> 
 
    </table></td></tr> 
 
</table>

1

只是width屬性

width = '100%' 

添加到內部表。它會使它遍佈包含單元的寬度。

DEMO

+0

Thankyou這是完美的。儘管它在第一位,但我認爲我必須接受Head In Cloud的回答。 – daninthemix