如下代码中,fisrt,second,third是3个inline-block元素,对于second元素加上absolute后确实
和老师说一样,还跟随在原来的位置;对于third元素来说,加上absolute之后,会跟在second元素
后面,但是与second元素之间的空格没有了,为什么?
因此,对于这个课程中图片的左上角VIP,不需要再i元素前放上注释符号也能实现。
<div class="father">
<div class='first'>first</div>
<div class="second">second</div>
<div class="third">third</div>
</div>
.father{
background:gray;
}
.first{
width:200px;
height:200px;
background:red;
display:inline-block;
}
.second{
width:200px;
height:200px;
background:yellow;
display:inline-block;
}
.third{
width:300px;
height:300px;
background:blue;
display:inline-block;
}