增加宽度

时间:2016-01-18 16:19:59

标签: html css

如何将单个<td>的宽度增加到表格的100%?

我已经尝试了width="100%"但它没有工作。

这是我想要实现的一个例子:

[enter image description here

HTML:

<div style="background-color:rgba(72,118,191,0.5);" class="lightblue step1"><h2 class="paddingh2">Step 1</h2><div class="form-item form-type-slider form-item-step-2">
  <label for="edit-step-2">How effective is your new business generation?</label>
</div>
<table class="bigtable">
    <tr>
  <td style="font-style: normal;">Currently</td>
   <td style="font-style: normal;">With a CRM</td>
    </tr>
    <tr>
        <td>You ranked your process</td>
        <td>Your process could be</td>
    </tr>
    <tr>
        <td><?php print $step1  . '/10'; ?></td>
        <td>9/10</td>
    </tr>
    <tr>
        <td>Your new business sales are:</td>
        <td>New business sales could increase by:</td>
    </tr>
    <tr>
        <td><?php print '£' . number_format($sales); ?></td>
        <td><?php print '£' . number_format($response1); ?></td>
    </tr>
<tr>
<td>How will a CRM help us generate more business?</td>
</tr>
<tr>
<td>Workbooks CRM improves new business by providing a single view of customers & prospects enabling you to drive specific marketing based on segmenting your lead data.

Reporting will enable management to ensure sales people are effective and following up leads and enquirers, whilst showing areas of potential focus (for example certain industries or marketing sources which bring in most leads).
</td>
    </table>
</div>

CSS

1 个答案:

答案 0 :(得分:1)

每行需要相同数量的列。您的第一行目前有两个<td>,因此有两列。最后两行只有一个<td>,因此只有一列。您可以使用colspan属性将单元格设置为跨多个列:

新代码:

<div style="background-color:rgba(72,118,191,0.5);" class="lightblue step1"><h2 class="paddingh2">Step 1</h2><div class="form-item form-type-slider form-item-step-2">
  <label for="edit-step-2">How effective is your new business generation?</label>
</div>
<table class="bigtable">
    <tr>
  <td style="font-style: normal;">Currently</td>
   <td style="font-style: normal;">With a CRM</td>
    </tr>
    <tr>
        <td>You ranked your process</td>
        <td>Your process could be</td>
    </tr>
    <tr>
        <td><?php print $step1  . '/10'; ?></td>
        <td>9/10</td>
    </tr>
    <tr>
        <td>Your new business sales are:</td>
        <td>New business sales could increase by:</td>
    </tr>
    <tr>
        <td><?php print '£' . number_format($sales); ?></td>
        <td><?php print '£' . number_format($response1); ?></td>
    </tr>
<tr>
<td colspan="2">How will a CRM help us generate more business?</td>
</tr>
<tr>
<td colspan="2">Workbooks CRM improves new business by providing a single view of customers & prospects enabling you to drive specific marketing based on segmenting your lead data.

Reporting will enable management to ensure sales people are effective and following up leads and enquirers, whilst showing areas of potential focus (for example certain industries or marketing sources which bring in most leads).
</td>
    </table>
</div>
相关问题