阿里云折扣码

轻云博客 > DIV+CSS > css设置宽高百分比及div高度百分比减像素的方法

css设置宽高百分比及div高度百分比减像素的方法

作者:Aisencici / 日期:2018-4-9 21:29:00 / 分类:DIV+CSS / 浏览:2836

CSS代码:

*{    margin: 0;
    padding: 0;
    list-style: none;}body{    width: 100%;
    height: 100%;}#nav{    position: relative;
    width: 100%;
    height:80px;
    background: #fff;}#logo_wrap{    width: auto;
    height: 100%;
    margin-left: 73px;}#logo_img{    float: left;
    width: 54px;
    height: 54px;
    margin-top: 13px;
    background: #ccc;}#logo_text{    float: left;
    width: auto;
    font-size: 22px;
    height: 54px;
    line-height: 54px;
    margin-top: 13px;
    margin-left: 20px;
    color:rgb(56,148,227);
    font-family: Fantasy;
    font-weight: bolder;}#mainbody{    position: absolute;
    width: 100%;
    height:  calc(100% - 80px);     //设置为父元素body的100%减去nav盒子的高度80px
    background: #ccc;} 


本文标签:
From:
分享到: