• 微信号:Zh-y9213
您当前的位置:爱资源分享网 > > 网站源码 > 教程合集

table表格自适应高度的解决办法

栏目:教程合集时间:2022-06-21 14:51阅读数:75人阅读

在专题中需要做一个单价展示的内容,用到了table,但是发现内容过多,高度会超出页面高度,用户体验很不好,于是,这里需要写一下css来使table自适应高度,代码很简单,完整代码如下:


<DOCTYPE HTML PUBLIC "-//W3C//DTDHTML 4.0 Transitional//EN">
<html>
        <HEAD>
                <title>table布局中自适应高度的解决办法</title>
<style type="text/css">
html,body{height:100%;font-size:12px;}
td {border:1px solid red;font-size: 12px;color: #000000;margin-left: 0px;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;}
#main{border:1px solid red;width:100%;min-height:100%;min-width:100%;height:100%;overflow:hidden !important;overflow: visible;}
#header{height:94px;border:1px solid red;}
</style>
</head>
<body>
<table id="main">
        <tr><td id="header">我的顶部</td></tr>
        <tr><td>我是主要内容</td></tr>
</table>
</body>
</html>
 

在线预览


套路很深,不支持下载!

本站所有文章、数据、图片均来自互联网,一切版权均归源网站或源作者所有。

如果侵犯了你的权益请来信告知我们删除。邮箱:737597453@qq.com