Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Html table, make one row larger

Tags:

html

I'm not very familiar with HTML, so excuse me if this is something simple, but I couldn't figure it out from googling. Anyway, the problem i'm having can be illustrated by this:

<html>
<body>
    <table border="1">
        <tr>
            <td>lots of words blah blah</td>
        </tr>
        <tr>
            <td>word</td>
            <td>word</td>
            <td>word</td>
        </tr>
    </table>
</body>
</html>

Is there a way that rather then have the first column be stretched, that just that first cell gets bigger? Theres only one cell in the first row, so theres alot of empty space. I'd like the cell to expand to fit the row, but instead it either stretches the whole column, or stretches vertically. How do I get around this?

like image 717
John Avatar asked Jul 07 '11 15:07

John


2 Answers

Use the colspan attribute to tell it to cover multiple columns, so in your case the td on your first row would be <td colspan="3">

like image 195
Anthony Grist Avatar answered Nov 15 '22 04:11

Anthony Grist


Set colspan="3" on the first <td> element.

Like this: <td colspan="3">.

The colspan value is how many columns do you want it to take up.

like image 40
Francisc Avatar answered Nov 15 '22 03:11

Francisc