二、position:relative和position:absolute配合实现元素在父容器右上角显示

<div class="parent-container">
  <button class="bt-read">续读</button>
</div>
.parent-container{
    margin-left: 20rpx;
    /* 父容器必须是相对定位,子容器的绝对定位才能达到预想效果 */
    position: relative;
    width: 100%;
    padding-top: 38rpx;
}
.bt-read{
	/* 绝对定位只有配合父容器的相对定位,才能达到预想效果 */
    position: absolute;
    right: 76rpx;
    top: 47rpx;
}

  上面代码就演示了续读按钮父容器右上角显示

猜你喜欢

转载自blog.csdn.net/panchang199266/article/details/88650612
今日推荐