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

吴陆奇

关注

阅读 29

2022-06-21

<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;
}

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


精彩评论(0)

0 0 举报