<div style="position:relativewidth:400pxheight:300pxbackground-color:yellow">
<div style="position:absolutebottom:0left:50pxwidth:300pxheight:150pxbackground-color:red"></div>
</div>
如果两个盒子是独立的,则可以这样:
<div style="width:400pxheight:300pxbackground-color:yellow"></div>
<div style="position:relativetop:-150pxleft:50pxwidth:300pxheight:150pxbackground-color:red">2</div>
其实有N多种方式实现,上述只是其中的一两种
可以用定义动画的方法,animation 动画名 时间 曲线 如何运动(设置无限循环)@keyfram 动画名 {
设置盒子的margin值
margin-top:0;
margin-top:40px;
}