form表单,tr循环生成,当超出页面显示时无滚动条

1. 在 form 外部加一个 div ;
2. 设置 div 的属性,宽、高、overfow 属性等;
3. 需要设置 table 的宽;
4. 具体代码:

<div class="bootbox-body" style="width: 650px;height: 400px;overflow-y: auto">
    <form  id="zdform"  novalidate="novalidate">
        <div class="UItable">
            <table cellpadding="0" cellspacing="0" border="0" width="100%" id="zdDataTable" class="tableA">
                <tbody>
                    <tr id="zdContent">
                        <td>
                            <label>字典表名:</label>
                        </td>
                        <td>
                            <span class="block input-icon input-icon-right">
                                <input type="text" id="zdName" name="zdName" readonly class="form-control">
                            </span>
                        </td>
                    </tr>
                    <#--循环添加-->
                </tbody>
            </table>
        </div>
    </form>
</div>

5. 页面:

未超出限制:
在这里插入图片描述
超出限制:
在这里插入图片描述
缺点:div 的高度限制死了,不够美观;右侧的滚动条也不够美观。

目前只能这样做了,有更好的办法可以来沟通一下。

猜你喜欢

转载自blog.csdn.net/qq_38152400/article/details/112986495