Waqas Ali
Waqas Ali

Reputation: 19

different table with same with

I am dynamically generating tables one after another using asp.net c#.I have different section in a table

td.section{width:200px;}

<table>
    <tr>
        <td colspan="2" class="section">Sec 1</td>
    </tr>
    <tr>
        <td>1</td>
        <td>s</td>
    </tr>
</table>
<table>
    <tr>
        <td class="section">Sec 2</td>
    </tr>
    <tr>
       <td>1</td>
    </tr>
</table>
<table>
    <tr>
       <td colspan="3" class='section'>Sec 3</td>
    </tr>
    <tr>
       <td colspan="3">1</td>
    </tr>
    <tr>
       <td>1</td>
       <td>1</td>
       <td>1</td>
    </tr>
</table>

I want each sections must be same with but I am unable to do this.Can you guide me how can I do this.

Upvotes: 0

Views: 61

Answers (1)

Matthew
Matthew

Reputation: 103

I added the width attribute at the top within a style tag and I think I got what you're aiming for. Note that width is spelled with a "d" and you are also missing a "<" on your second tag.

Finished product:

<style>
td.section{width:200px;}
</style>
<table>
<tr>
<td colspan='2' class='section'>Sec 1</td>
</tr>
<tr>
<td>1</td>
<td>s</td>
</tr>
</table>
<table>
<tr>
<td class='section'>Sec 2</td>
</tr>
<tr>
<td>1</td>

</tr>
</table>

<tr>
<td colspan='3' class='section'>Sec 3</td>
</tr>
<tr>
<td>1</td>

</tr>
</tr>
<tr>
<td>1</td>
<td>1</td>
<td>1</td>
</tr>
</table>

Upvotes: 1

Related Questions