Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Size html table to size of DIV tag?

Status
Not open for further replies.

FancyPrairie

Programmer
Oct 16, 2001
2,917
US
I plan on creating a composite control. To simulate how the composite control would work when resizing it in the designer, I created a table within a DIV tag. The table consists of 3 rows.

The first row contains a label.
The second row contains a text box.
The third row contains a list box.

I want both the width and height of the table to be 100%. That is, it fits within the DIV tag (taking into effect the margins around the table). I can't seem to get the 3rd row to work properly. I can't get the list box to be the same size as the row.

Note that as I resize the DIV tag, the table should grow and shrink accordingly.

I just realized I may be posting this in the wrong forum since I'm attempting to do this in Visual Studio 2005. However, I would think the table structure would be the same.

Here's my code:
Code:
    <div style="position: absolute; overflow: hidden; top: 15px; width: 427px; left: 80px; height: 561px; border-right: red 1px solid; border-top: red 1px solid; border-left: red 1px solid; border-bottom: red 1px solid;">
        <table style="margin-left: 1%; margin-right: 1%; height: 100%" cellpadding='0' cellspacing='0' border='0' width='98%'>
            <tr><td>
                    <asp:Label ID="Label1" runat="server" Style="width: 100%;" Text="Label" ></asp:Label>
            </td></tr>

            <tr><td style="width: 100%">
                    <asp:TextBox ID="TextBox1" runat="server" Style="width: 100%" ></asp:TextBox>
            </td></tr>
            
            <tr><td style="height: 88%">
                    <asp:ListBox ID="ListBox1" runat="server" Style="position: fixed; top: 0; width: 100%; height: 100%"></asp:ListBox>            
            </td></tr>
        </table>
    </div>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top