开发者

Shrink a cell (in an absolutely-positioned ASP.NET table) to fit its contents?

开发者 https://www.devze.com 2022-12-27 10:59 出处:网络
My webpage currently looks like this: <asp:Table runat=\"server\" style开发者_Python百科=\"position: absolute;

My webpage currently looks like this:

<asp:Table runat="server" style开发者_Python百科="position: absolute;
    left: 0%; top: 82%; right: 0%; bottom: 0%; width: 100%; height: 18%"
    CellPadding="0" CellSpacing="0" GridLines="Both">
    <asp:TableRow>
        <asp:TableCell>
            Content1
        </asp:TableCell>

        <asp:TableCell Width="2.5%">
        </asp:TableCell>

        <asp:TableCell >
            Content2
        </asp:TableCell>
    </asp:TableRow>
</asp:Table>

http://img684.imageshack.us/img684/9677/tableu.png

But I need it to look like this:

http://img263.imageshack.us/img263/4508/table2k.png

"Content1" is of unknown size, and the table will have to adjust to fit it in, but without taking any unnecessary space away from "Content2." I can't use "display: table" because it isn't supported in IE7 and such, so I'm pretty much stuck using a regular table element unless there is something better out there that is supported in older browsers.

Does anyone know how this can be accomplished?


Why not add a width to the Content2 cell? Something like:

<asp:Table runat="server" style="position: absolute;
    left: 0%; top: 82%; right: 0%; bottom: 0%; width: 100%; height: 18%"
    CellPadding="0" CellSpacing="0" GridLines="Both">
    <asp:TableRow>
        <asp:TableCell>
            Content1
        </asp:TableCell>

        <asp:TableCell Width="2.5%">
        </asp:TableCell>

        <asp:TableCell Width="97.5%">
            Content2
        </asp:TableCell>
    </asp:TableRow>
</asp:Table>
0

精彩评论

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