如页面
newslist.aspx
<table height="100%>
<tr>
<td>head
</td>
</tr>
<tr>
<td height="100%>
用户自定义控件listmain.ascx
</td>
</tr>
<tr>
<td>foot
</td>
</tr>
</table>
listmain.ascx
<table height="100%">
<tr>
<td>列表</td>
</tr>
<tr height=100%>
<td valign="bottom">分页</td>
</tr>
</table>
我上面要求的就是listmain.ascx在newslist中占100%的高
然后分页显示在最下面
但我运行时分页那里的100%无效
newslist.aspx
<table height="100%>
<tr>
<td>head
</td>
</tr>
<tr>
<td height="100%>
用户自定义控件listmain.ascx
</td>
</tr>
<tr>
<td>foot
</td>
</tr>
</table>
listmain.ascx
<table height="100%">
<tr>
<td>列表</td>
</tr>
<tr height=100%>
<td valign="bottom">分页</td>
</tr>
</table>
我上面要求的就是listmain.ascx在newslist中占100%的高
然后分页显示在最下面
但我运行时分页那里的100%无效
<script runat="server">
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<style>
html,body,form{height:100%;margin:auto}
</style>
</head>
<body>
<form id="form1" runat="server">
<table height="100%>
<tr>
<td>head
</td>
</tr>
<tr>
<td height="100%">
<table height="100%" style="background:red">
<tr>
<td>列表</td>
</tr>
<tr height=100%>
<td valign="bottom">分页</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>foot
</td>
</tr>
</table></form>
</body>
</html>
————————————————————————————————————————
你自己的理解不要强加给别人。你应该指出你的那种理解中的“head”、“foot”按照你的理解应该如何摆放,然后别人可以帮你看看有没有按照你那种理解的表示方法可以替换,而不应该摆出“反正我设置了100%你就应该显示为100%高,别的地方没办法摆放我不管”的孩子气逻辑,这不是理由。如果给你把它显示100%,你又会指出table的100%或者head、foot没有显示等,那样每人相信你的问题是认真的了。
呵呵
“listmain.ascx在newslist中占100%的高”是没有道理的。
并不是指完全100%的高度了
html标签中,子容器的高宽值采取百分比,需要看父容器是否定义了高宽值。
譬如
html,body{
width:100%
height:100%;
}
div.sub
{
height:80%
}
应用sub
一开始body获取的高度是固定死了的avaible高度了,div.sub 才能获取80%的高度,不然这个百分比是无意义的
...
<body>
<div class=sub></div>
</body>
....很多情况下面有些人喜欢定义<div style="border:1px solid #000000;width:100%">some text here</div>
实际上div的宽度是1px+100% 父容器宽 + 1px 大于父容器宽度了。 明显会把父容器给撑开,布局出现瑕疵,但是浏览器读出来时没有问题的了。简单的加法加就是么。在布局的时候没有计算好大小,往往不能达到设计的布局意图。除非是自适应内容的宽高度的了。
===========================================================
“我上面要求的就是listmain.ascx在newslist中占100%的高
然后分页显示在最下面
但我运行时分页那里的100%无效”
===========================================================
如果想达到这个目的,用一个<asp:panel id="panelNews" style="height:300px" >插入listmain.ascx控件</asp:panel>控件或者设置一个<div id="news" style="height:300px">插入listmain.ascx控件</div>使用百分比的时候,给父容器标签定义高度
--------------------------------------------------------
可能我写的不是很清楚
newslist.aspx
---------------
|页首 |
---------------
|菜 | 用户控件 |
|单 | |
---------------
|页脚 |
---------------
listmain.ascx
---------------
|列表 |
---------------
|分页 |
---------------
----------------------------
我的要求是这样的:
比如用户控件生成的时候高只有200px
而菜单那一行的高度有300px
这个时候让ascx自动100%占用那个TD也就是变成了有300px的高
当ascx拉高的时候他里的分页的高度不变也把那些拉高的高度都给列表那一行
我的生成效果:
---------------
|页首 |
---------------
|菜 |列表 |
| |分页 |
|单 | |
---------------
|页脚 |
---------------
而我要的效果是
---------------
|页首 |
---------------
|菜 |列表 |
| | |
|单 |分页 |
---------------
|页脚 |
---------------
谢谢
如果想达到这个目的,用一个<asp:panel id="panelNews" style="height:300px" >插入listmain.ascx控件</asp:panel>控件或者设置一个<div id="news" style="height:300px">插入listmain.ascx控件</div>使用百分比的时候,给父容器标签定义高度
------------------------------------------------
但是我的
---------------
|菜 | 用户控件 |
|单 | |
---------------
这一行的高度也是未知的他是根据菜单自应大小的
谢谢
下面的 分页要 对齐菜单底部么?
呵呵,把分页从 <tfoot>中取出来么
使用<div id="pageFoot" style="position:absolute;left:10px;bottom:10px">第1、2、3。。页</div>
使用绝对位置了,对齐底部(左下方)么
设置父标签的style="position:relative;"没有调试过,就这样试试看么
<div id="pageFoot" style="position:absolute;left:10px;bottom:10px">第1、2、3。。页</div>
---------------------------------
我用你的方法他跑到页面的最下面了,你的是一个浮动层吧