Consider the following HTML table definition : <table border =1> <tr> <td…

2017

Consider the following HTML table definition :

<table border =1>

    <tr>

        <td colspan=2> Text A </td>

    </tr>

    <tr>

        <td> Text B </td>

        <td>zText C </td>

    </tr>

    <tr>

        <td> rowspan =2> Text D </td>

        <td> Text E </td>

    </tr>

    <tr>

        <td> Text F </td>

    </tr>

</table>

The above HTML code would render on screen as :

Attempted by 227 students.

Show answer & explanation

Solution: determine how colspan and rowspan affect the layout.

Key points:

  • The first row has a cell with colspan=2, so "Text A" occupies both columns in row 1.

  • The second row contains two separate cells: left cell "Text B" and right cell "Text C".

  • In the third row the left cell is "Text D" with rowspan=2, so it occupies the left column of both the third and fourth rows.

  • The third-row right cell is "Text E" and the fourth-row right cell is "Text F" (because the left cell in row 4 is taken by the rowspan of "Text D").

Therefore the correct rendering is the image that shows:

  • "Text A" spanning both columns in the top row;

  • "Text B" (left) and "Text C" (right) on the second row;

  • "Text D" occupying the left column of the last two rows (rowspan=2), with "Text E" and then "Text F" in the right column of those rows.

Match this description to the images; the image that corresponds exactly is the correct answer.

Explore the full course: Tpsc Assistant Technical Officer