开发者

set border for table with overflow is auto

开发者 https://www.devze.com 2023-01-03 02:09 出处:网络
I would like to have a border for the table with class name as \"wanttosetborder\".开发者_如何转开发 Without the div it is setting border for this table. With the div tag, it is setting border till th

I would like to have a border for the table with class name as "wanttosetborder".开发者_如何转开发 Without the div it is setting border for this table. With the div tag, it is setting border till the last row before div tag,(i.e a line after H2 is displayed) after that no border is displayed.

Please find the code below.

<html>
    <head>
    <head>
        <style type="text/css">
            #user{width: 50px;height:150px;overflow:auto;position:absolute}
        </style>
    </head>
</head>
<body>
    <TABLE class="wanttosetborder" CELLPADDING=1 cellspacing="1" border="1">
        <tr><td>ABC</td></tr>
        <tr><td>H2</td></tr>
        <tr>
            <td>
                <div id="user">
                    <table>
                        <?php for($i=1; $i<=10;$i++) { ?>
                        <tr><td>123</td> </tr>
                            <?php }?>
                    </table>
                </div>
            </td>
        </tr>
    </TABLE>
</body>
</html>


If I understand you correctly, you want it to show the border with the div inside the table column?

Your div is styled with a 'position: absolute', which will place the div on top of the table, making the border invisible. Remove the position attribute, and your table will contain the div and still show the table border.

0

精彩评论

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