CSS自动大小Html表单

时间:2014-03-25 15:05:10

标签: html css

我们将自动</form>尺寸设置为</body>尺码时出现问题...我们将100%提供给<body><html><form>,但<form>大小未设置为100%...我们希望等于<body><form>

我们的HTML代码:

<body>
<form id="form1" runat="server" class="form1">
    <div id="main">
     <div id="header" class="header">
        <div id ="logoDiv" style="height:100%; margin-left:5%; float:left; width:40%">
        </div>
        <div id="leftMain">                
           <uc1:profile id="profileVw" runat="server"> </uc1:profile>
        </div>
        <div id="rightMain">
            <asp:ContentPlaceHolder ID="ContentPlaceHolder1"  runat="server">
            </asp:ContentPlaceHolder>
        </div>
        <div style="clear:both;"></div>
    </div>
    <div style="clear:both;"></div>
</form>
</body>

我们的css代码:

html{height:100%; padding: 0px 0px 0px 0px ; 
}
body {
position:absolute; top:0;  bottom:0; right:0; left:0; 
margin: 0px 0px 0px 0px 
}
#form1 {  
background-color:#e8e3e6; height:100%; width:100%; margin:0px
}
#main { height:auto; background-color:Blue; margin: auto 5% auto 5%; width: 90%; 
}

1 个答案:

答案 0 :(得分:0)

html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;    
}
#form1 {  
    background-color:#e8e3e6; 
    height:100%; 
    width:100%; 
    margin:0;
}
#main { 
    height:100%; 
    background-color:Blue; 
    margin: 0 auto; 
    width: 90%; 
}

</form>关闭</div>

之前