Div+css+js实现高度适应浏览器,做出的效果像winform

 布局结构

*******************head**************************

**************************************************

                 *

     Left     *                     right

                 **************************************

                 ****************foot******************

                                       (图)

要求: Left,right,foot的高度随着浏览器大小改变与改变,foot总在下面,

代码: div+css+js实现

<%@ Page Language="C#" AutoEventWireup="true" Theme="SkinDefault" CodeFile="副本 memberQuery.aspx.cs" Inherits="Application_memberQuery" %>

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>无标题页</title>
</head>
<script>
    function OnWindowsReSize()
    {
       
        document.getElementById('PageSideleft').style.height = document.body.clientHeight - 20 - 2;
        document.getElementById('PageSideRight').style.height = document.body.clientHeight - 20 - 2;
       
        document.getElementById('PageSideRight').style.width = document.body.clientWidth - 154 - 2;
        document.getElementById('PageSideRight').style.left = '154px';
        document.getElementById('PageRight_Head').style.width = document.body.clientWidth - 154 - 2;
        document.getElementById('PageRight_Center').style.width = document.body.clientWidth - 154 - 2;

        document.getElementById('PageRight_Center').style.height = document.body.clientHeight - 20 - 2 - 22 - 2 - 22 - 2;
       
    }
</script>
<body bottommargin="0" leftmargin="0" rightmargin="0" topmargin="0" style="width: 100%; height: 100%;" οnlοad="OnWindowsReSize()" οnresize="OnWindowsReSize()">
    <form id="form1" runat="server">
        <div id="PageHead">  </div>
        <div id="PageSideLeft">
            <div id="PageLeft_Head">         </div>
            <div id="PageLeft_Center">       </div>
        </div>
        <div id="PageSideRight">
            <div id="PageRight_Head">           </div>
            <div id="PageRight_Center">         </div>
            <div id="PageRight_Foot">             </div>
        </div>
    </form>
</body>
</html>

css:

body
{
    font-size: 9pt;
}

#PageHead
{
    width: 100%;
    background-image: url(../../Application/images/title.jpg);
    color: #ffffff;
    height: 20px;
    position: absolute;
    top: 0;
}
       
#PageSideLeft
{
       padding-bottom: 0;
       margin-bottom: 0;
       position: absolute;
       top: 20px;
       width: 150px;
       border-right: lightsteelblue 1px solid;
       border-top: lightsteelblue 1px solid;
       border-left: lightsteelblue 1px solid;
       border-bottom: lightsteelblue 1px solid;
}
#PageSideRight
{
       padding-bottom: 0;
       margin-bottom: 0;
       position: absolute;
       top: 20px;

       border-right: lightsteelblue 1px solid;
       border-top: lightsteelblue 1px solid;
       border-left: lightsteelblue 1px solid;
       border-bottom: lightsteelblue 1px solid;
}  
#PageRight_Head
{
    height: 22px;
    border-bottom: lightsteelblue 1px solid;
    vertical-align: baseline;
    text-align: left;
    background-color: lavender;
}     
#PageRight_Head input
{
    border-right: gainsboro 1px solid;
    background-position: 0% 50%;
    border-top: gainsboro 1px solid;
    font-size: 9pt;
    background-attachment: scroll;
    border-left: gainsboro 1px solid;
    color: #000000;
    border-bottom: gainsboro 1px solid;
    background-repeat: repeat;
    height: 16px;
    background-color:expression((this.readOnly && this.readOnly==true)?"GhostWhite":"")
}

#PageLeft_Head
{
    height: 22px;
    border-bottom: lightsteelblue 1px solid;
    vertical-align: middle;
    text-align: center;
    background-color: lavender;
}
#PageRight_Center
{
    border-bottom: lightsteelblue 1px solid;
    background-color: ghostwhite;
}
#PageLeft_Center
{
    vertical-align: top;
    text-align: left;
}
#PageRight_Foot
{
    height: 20px;
    vertical-align: baseline;
    text-align: right;
    background-color: lavender;
}

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值