开发者

Html table, make one row larger

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 illustra开发者_JAVA技巧ted 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?


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">


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.


Each of your rows should have the same number of columns. In this case, you can explicitly tell your large cell to span all of the columns, like this:

<tr> <td colspan="3">lots of words blah blah  </td>  </tr>


you can add the width attribute to the element you want to change.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜