PHP群:95885625 Hbuilder+MUI群:81989597 站长QQ:634381967
    您现在的位置: 首页 > 开发编程 > HTML+CSS > 正文

    float引起层飘出父层的解决方法

    作者:admin来源:网络浏览:时间:2020-09-30 00:07:50我要评论
    导读:1.加clear空div.clearfix:after {content: .; display: block;height: 0;clear: both;visibility: hidden;}.clearfix {display: i...
    1.加clear空div
    .clearfix:after {
    content: “.”; display: block;
    height: 0;
    clear: both;
    visibility: hidden;}
    .clearfix {display: inline-block;}
    /* Hides from IE-mac */
    * html .clearfix {height: 1%;}
    .clearfix {display: block;}/* End hide from IE-mac */
    .clearfix {
    display: block;
    margin: 0px;
    clear: both;
    padding: 0px;
    visibility: hidden;
    background-color:#666666;
    border:0px none #FFFFFF;
    }
    .clearfix:after { height: 1px;}

    使用方法:
    在所有浮动层之后加上这个层


    2.把背景层加浮动,但是这个方法会影响其他的div,有时候好用。

    3.加 overflow 这个也有问题,会影响div的外观。
    转载请注明(B5教程网)原文链接:https://b5.mxunkeji.com/content-70-1741-1.html
    相关热词搜索: