Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Nov 2009
    Posts
    53
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Question getting fieldset to take up 100% height of table cell

    How do I force my fieldset to take up 100% of the height of the table cell it's in?

  • #2
    Banned
    Join Date
    Feb 2011
    Posts
    2,699
    Thanks
    13
    Thanked 395 Times in 395 Posts
    To set a % height on an element, all of its parent elements must have a height set on them.

    Maybe use this demo as a guide.

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
        <head>
            <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
            <title></title>
            <style type="text/css">
                html,body {
                    height: 100%;
                }
                fieldset {
                    margin: 0px 0px 0px 0px;
                    padding: 0px 0px 0px 0px;
                    border: 2px solid red;
                }
                #table1 {
                    height: 300px;
                }
                #table1 tr, #table1 td {
                    height: 100%;
                }
                #table1 td fieldset {
                    height: 100%;
                }
            </style>
            <script type="text/javascript"></script>
        </head>
        <body>
            <table id="table1" border="1" cellspacing="0">
                <tr>
                    <td>
                        <fieldset>
                            <input type="text" name="txt1" />
                        </fieldset>
                    </td>
                    <td>line 1<br />line 2<br />line 3<br />line 4<br />line 5<br />line 6</td>
                </tr>
            </table>
        </body>
    </html>


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •