CSS-Position

.test1 {
    color:white;
    height: 50px;
    line-height: 50px;
    background:black;
}
.test2 { --------------------------在文档流浮动起来,块级自动沾满行取消,宽度自适应内容,视同行内块元素,紧跟着兄弟元素,相对位置不变,后面的元素会前移动
    position: absolute; -----保持在流中位置不变,默认浮动起来,可以相对于父级元素设置left/right/top/bottom。
    height: 50px;
    line-height: 50px;
    background:red;
    clip: rect(0 auto 40px 10px); ------剪切是相对于元素左上角0,0
}
.test3 {
    color:white;
    height: 50px;
    line-height: 50px;
    background:black;
}

 

float在绝对定位时无效

posted @ 2018-04-20 14:45  FromScratch  阅读(116)  评论(0)    收藏  举报