我想让我的表格占据屏幕的 80%,但现在它只是表格内容的大小。
#ecom-mainarea .center
{
margin-left: 10%;
position: relative;
width: 80%;
height: 80%; /* when this is 500px it works fine, but % doesn't work */
border: 1px solid;
border-bottom-color: teal;
border-top-color: gray;
border-left-color: gray;
border-right-color: teal;
background-color: white;
voice-family: "\"}\"";
voice-family: inherit;
vertical-align: text-top;
}
您需要确保html
and body
元素有100%
高度。他们需要从上到下伸展。如果不是html
and body
元素将与您的桌子一样高。
这里有一个工作示例:
<!doctype html>
<html>
<head>
<title>Table height</title>
<style>
html, body
{
padding: 0;
margin: 0;
height: 100%;
}
</style>
</head>
<body>
<table style="background: cyan; height: 80%;">
<tr>
<td>
Table has 80% of the height of the body
</td>
</tr>
</table>
</body>
</html>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)