Fearghal
Fearghal

Reputation: 11427

Html table - why does my third row appear in second

Why does the below html yield a table of 2x2 cells instead of 3 rows, 1st with 2 cells and the next 2 with one cell spanning 2?

<table cellpadding="5" width="200">
    <tr>
        <td><img id="Button1_logoImg" src="" style="height:75px;width:75px;" alt="sButton1_logoImg" /></td><td><img id="Button1_errorImg" src="" style="height:50px;width:50px;" alt="Button1_logoImg" /></td>
    </tr>
    <tr>
        <td width="100%" rowspan="2"><input name="Button1$mainTextTb" type="text" value="changed" id="Button1_mainTextTb" style="font-size:20pt;width:180px;" /></td>
    </tr>
    <tr>
        <td rowspan="2" width="100%"><span id="Button1_subTextLbl" style="font-size:12pt;">sub text</span></td>
    </tr>
</table>

Upvotes: 0

Views: 74

Answers (2)

Rishabh Jain
Rishabh Jain

Reputation: 108

your code

<table cellpadding="5" width="200">
    <tr>
        <td><img id="Button1_logoImg" src="" style="height:75px;width:75px;" alt="sButton1_logoImg" /></td><td><img id="Button1_errorImg" src="" style="height:50px;width:50px;" alt="Button1_logoImg" /></td>
    </tr>
    <tr>
        <td width="100%" rowspan="2"><input name="Button1$mainTextTb" type="text" value="changed" id="Button1_mainTextTb" style="font-size:20pt;width:180px;" /></td>
    </tr>
    <tr>
        <td rowspan="2" width="100%"><span id="Button1_subTextLbl" style="font-size:12pt;">sub text</span></td>
    </tr>
</table>

Replace rowspan with colspan

Edited code

  <table cellpadding="5" width="200">
        <tr>
            <td><img id="Button1_logoImg" src="" style="height:75px;width:75px;" alt="sButton1_logoImg" /></td><td><img id="Button1_errorImg" src="" style="height:50px;width:50px;" alt="Button1_logoImg" /></td>
        </tr>
        <tr>
            <td width="100%" colspan="2"><input name="Button1$mainTextTb" type="text" value="changed" id="Button1_mainTextTb" style="font-size:20pt;width:180px;" /></td>
        </tr>
        <tr>
            <td colspan="2" width="100%"><span id="Button1_subTextLbl" style="font-size:12pt;">sub text</span></td>
        </tr>
    </table>

Upvotes: 0

gmiley
gmiley

Reputation: 6604

Replace your rowspan with colspan in row 2 and 3.

Upvotes: 1

Related Questions