开发者

HTML: Width for a td independent of the upper tr?

if i have a table like following, I didn't make it to define a special width for a single element. Is this possible?

For illustration, i've tried it like this:

<table border="1">
    <tr>
        <td>Bla</td>
        <t开发者_StackOverflow中文版d>_____________________________________________________</td>
        <td>Bla2</td>
    </tr>
    <tr>
        <td>Blub</td>
        <td style="width: 100px;">Bli</td>
        <td>Hello</td>
    </tr>
</table>


Is this possible?

Not really, no. The only thing that exists is the colspan and rowspan attributes that can make a cell span across two columns like so:

<table border="1">
    <tr>
        <td>Bla</td>
        <td>_____________________________________________________</td>
        <td>Bla2</td>
    </tr>
    <tr>
        <td colspan="2">Blub Bli - I will span across the whole large line!</td>
        <td>Hello</td>
    </tr>
</table>

but the exact thing that you want - being completely flexible in cell widths - can be achieved only by two separate tables.


Since you have not specified width explicitly, your other TDs will also be as large as the largest one:

<td>_____________________________________________________</td>

Same is the case with table tag because you have not set width for it too.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜