野花–父盒子相对定位,设置padding值,那么绝对定位的子盒子起点在哪里?

        .yellow {
            position: relative;
            width: 300px;
            height: 300px;
            padding: 20px;
            background-color: yellow;
        }
        .blue {
            position: absolute;
            top:0;
            left: 0;
            width: 100px;
            height: 100px;
            background-color: blue;
        }

 

 不受影响,起点依然是整个盒子的边角,而不是padding后的内容边角

原文地址:http://www.cnblogs.com/ericyjchung/p/16852107.html

发表评论

您的电子邮箱地址不会被公开。