CSS 技巧

说明:

    IE: 微软的自带浏览器, 用户群最多的浏览器

    火狐: 这里就作为W3C标准浏览器

Padding:

    padding在火狐(W3C标准)和IE中的解释是不同的. IE中padding是包含在宽高中的, 火狐是不包含宽高中的.

    所以在使用padding的时候不要设定其相应的宽高, 而应该由内部盒装模型去撑开此盒装模型的相应宽高

示例:

<div style="padding:15px;">
    <div style="100px;height:100px;">
        我是内部盒装模型
    </div>
</div>

浮动与清除:

        .left
        {
            float: left;
        }

        .right
        {
            float: right;
        }

        .clear
        {
            background: none;
            border: 0;
            clear: both;
            display: block;
            float: none;
            font-size: 0;
            margin: 0;
            padding: 0;
            overflow: hidden;
            visibility: hidden;
            0;
            height: 0;
        }

空标签清除浮动

  .clr{clear:both;}

  <p class="clr"></p> 

原文地址:https://www.cnblogs.com/henw/p/2343626.html