Pau*_*els 2 html css asp.net height
我试过这样做,但似乎只是被忽略了.我发现一些文章说如果你想这样做,那么你必须确保父对象也是100%.我有以下内容:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server" style="height:100%">
<title>Untitled Page</title>
<asp:ContentPlaceHolder id="head" runat="server">
</asp:ContentPlaceHolder>
<style type="text/css">
.MasterStyle
{
width: 98%;
height: 100%;
}
.ContentStyle
{
width: 100%;
}
.TableStyle
{
width: 133px;
height: 100%;
}
</style>
</head>
<body class="MasterStyle">
<form id="frmMaster" runat="server">
<div class="ContentStyle">
<asp:Label runat="server" Text="My Site Name" Font-Bold="true" Font-Names="MS-Sans"
Style="text-align:right" Width="100%" />
<br />
</div>
<hr />
<table style="width:100%; height:100%" border="true">
<tr>
<td class="TableStyle" style="height:100%">
Run Code Online (Sandbox Code Playgroud)
桌子周围有一个边框,可以看到它没有填满高度.谁能告诉我为什么我没有达到100%的高度?
我相信这也取决于浏览器,实现方式有所不同......
但尝试设置<html>为100%的高度,因为它是周围的元素<body>.层次结构是html> body> table,如果最外面的元件没有被设置为100%,内那些不能得到任何更大.
编辑:
看你的源代码更接近,我相信你的表实际上是坐在html> body> form> table,所以也许你的东东设置表格高度为100%,太.我注意到你<head>的设置为100%,最好删除它,因为<head>它不是表格层次结构的一部分.你永远不会如何设置高度<head>可能会混淆渲染引擎......
| 归档时间: |
|
| 查看次数: |
6955 次 |
| 最近记录: |