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

Posted by Giffyguy on Stack Overflow See other posts from Stack Overflow or by Giffyguy
Published on 2010-04-14T21:03:29Z Indexed on 2010/04/14 21:53 UTC
Read the original article Hit count: 176

Filed under:
|
|
|
|

My webpage currently looks like this:

<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 >
            Content2
        </asp:TableCell>
    </asp:TableRow>
</asp:Table>

But I need it to look like this:

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

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about table