浮动div,100%高度 [英] Floated div, 100% height

查看:126
本文介绍了浮动div,100%高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

t >


***** {




  -webkit-tap-highlight -color:rgba(0,0,0,0); 
margin:0;
padding:0;
list-style:none;
}




#footer-gradient {




  position:relative; 
width:100%;
overflow:hidden;
padding:0 18px;
margin-left:-18px;
background:-moz-linear-gradient(top,rgba(214,212,200,0.5)0%,rgba(214,212,200,0.75)25%,rgba(214,212,200,1)50%,rgba(214,212,200,0.75) ,rgba(214,212,200,0.5)100%); / * FF3.6 + * /
background:-webkit-gradient(linear,left top,left bottom,color-stop(0%,rgba(214,212,200,0.5)),color-stop(25%,rgba (214,212,200,0.75)),色停(50%,rgba(214,212,200,1)),停止色(75%,rgba(214,212,200,0.75)),色停(100%,rgba(214,212,200,0.5) )); / * Chrome,Safari4 + * /
background:-webkit-linear-gradient(top,rgba(214,212,200,0.5)0%,rgba(214,212,200,0.75)25%,rgba(214,212,200,1)50% (214,212,200,0.75)75%,rgba(214,212,200,0.5)100%); / * Chrome10 +,Safari5.1 + * /
background:-o-linear-gradient(top,rgba(214,212,200,0.5)0%,rgba(214,212,200,0.75)25%,rgba(214,212,200,1)50 %,rgba(214,212,200,0.75)75%,rgba(214,212,200,0.5)100%); / * Opera 11.10+ * /
background:-ms-linear-gradient(top,rgba(214,212,200,0.5)0%,rgba(214,212,200,0.75)25%,rgba(214,212,200,1)50% (214,212,200,0.75)75%,rgba(214,212,200,0.5)100%); / * IE10 + * /
background:linear-gradient(to bottom,rgba(214,212,200,0.5)0%,rgba(214,212,200,0.75)25%,rgba(214,212,200,1)50%,rgba(214,212,200,0.75 )75%,rgba(214,212,200,0.5)100%); / * W3C * /
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr ='#80d4d2c6',endColorstr ='#80d4d2c6',GradientType = 0); / * IE6-9 * /
-moz-box-shadow:inset 0 0 98px#a9a798;
-webkit-box-shadow:inset 0 0 98px#a9a798;
box-shadow:inset 0 0 98px#a9a798;

}




.col {




  margin-left:0; 
float:left;
}




.col:first-child {




  margin-left:0; 
}




.footer {




  width:33%; 
* width:expression(Math.floor(0.33 *(this.parentNode.offsetWidth - parseFloat(this.parentNode.currentStyle.paddingLeft) - parseFloat(this.parentNode.currentStyle.paddingRight)))+px) ;
}




.footer-left {




  background-color:red; 
height:100%!important;
min-height:100%!important;
}




.footer {




  background-color:red; 
height:100%!important;
min-height:100%!important;
}



我想让div.col拉伸到100%的高度。我试过几件事,但没有一个解决了这个问题。



提前感谢!

解决方案

ol>

  • 设置三个元素的容器(#footer-gradient display:table

  • 并设置元素本身( .col display:table-cell

  • 移除浮动图片。

  • 成功。






  •  #footer-gradient {
    display:table;
    }
    #footer-gradient .col {
    display:table-cell;
    float:none;
    }


    t

    ***** {

        -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
        margin: 0;
        padding: 0;
        list-style: none;
    }
    

    #footer-gradient {

        position: relative;
        width: 100%;
        overflow: hidden;
        padding: 0 18px;
        margin-left: -18px;
        background: -moz-linear-gradient(top,  rgba(214,212,200,0.5) 0%, rgba(214,212,200,0.75) 25%, rgba(214,212,200,1) 50%, rgba(214,212,200,0.75) 75%, rgba(214,212,200,0.5) 100%); /* FF3.6+ */
        background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(214,212,200,0.5)), color-stop(25%,rgba(214,212,200,0.75)), color-stop(50%,rgba(214,212,200,1)), color-stop(75%,rgba(214,212,200,0.75)), color-stop(100%,rgba(214,212,200,0.5))); /* Chrome,Safari4+ */
        background: -webkit-linear-gradient(top,  rgba(214,212,200,0.5) 0%,rgba(214,212,200,0.75) 25%,rgba(214,212,200,1) 50%,rgba(214,212,200,0.75) 75%,rgba(214,212,200,0.5) 100%); /* Chrome10+,Safari5.1+ */
        background: -o-linear-gradient(top,  rgba(214,212,200,0.5) 0%,rgba(214,212,200,0.75) 25%,rgba(214,212,200,1) 50%,rgba(214,212,200,0.75) 75%,rgba(214,212,200,0.5) 100%); /* Opera 11.10+ */
        background: -ms-linear-gradient(top,  rgba(214,212,200,0.5) 0%,rgba(214,212,200,0.75) 25%,rgba(214,212,200,1) 50%,rgba(214,212,200,0.75) 75%,rgba(214,212,200,0.5) 100%); /* IE10+ */
        background: linear-gradient(to bottom,  rgba(214,212,200,0.5) 0%,rgba(214,212,200,0.75) 25%,rgba(214,212,200,1) 50%,rgba(214,212,200,0.75) 75%,rgba(214,212,200,0.5) 100%); /* W3C */
        filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#80d4d2c6', endColorstr='#80d4d2c6',GradientType=0 ); /* IE6-9 */
        -moz-box-shadow:    inset 0 0 98px #a9a798;
        -webkit-box-shadow: inset 0 0 98px #a9a798;
        box-shadow:         inset 0 0 98px #a9a798;
    
    }
    

    .col {

        margin-left: 0;
        float: left;
    }
    

    .col:first-child {

        margin-left: 0;
    }
    

    .footer {

        width: 33%;
        *width: expression(Math.floor(0.33 * (this.parentNode.offsetWidth - parseFloat(this.parentNode.currentStyle.paddingLeft) - parseFloat(this.parentNode.currentStyle.paddingRight))) + "px");
    }
    

    .footer-left {

        background-color: red;
        height: 100% !important;
        min-height: 100% !important;
    }
    

    .footer {

        background-color: red;
        height: 100% !important;
        min-height: 100% !important;
    }
    

    I would like to make the div.col stretched to 100% height. I've tried few things but none of them fixed the problem. I'm counting on your help.

    Thanks in advance !

    解决方案

    1. Set the three elements' container (#footer-gradient) display: table
    2. And set the elements themselves (.col) display: table-cell
    3. Remove the floating.
    4. Success.


    #footer-gradient {
        display: table;
    }
    #footer-gradient .col {
        display: table-cell;
        float: none;
    }
    

    这篇关于浮动div,100%高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆