css实现,正常情况下div从左到右一次排列,宽度超出时,右侧最后一个div固定住,左侧其他div滚动

需求:正常情况下
css实现,正常情况下div从左到右一次排列,宽度超出时,右侧最后一个div固定住,左侧其他div滚动_第1张图片
宽度超出时:
在这里插入图片描述
实现:



.......

.jieduanbox {
  display: flex;
  align-items: center;
  overflow-x: auto; /* 当内容超出时显示横向滚动条 */
  overflow-y: hidden;
  }
  
  .rightBtn{
  flex-shrink: 0; /* 防止右侧内容缩小 */
  position: sticky;
  right: 0;
}

你可能感兴趣的:(css,前端,javascript)