2 回答

TA贡献1906条经验 获得超10个赞
要修复此问题,您可以将 .container justify-content 值从更改justify-content:center
为justify-content:start

TA贡献1831条经验 获得超10个赞
他们的 .css 代码中存在错误。在 .Box 中,您需要更改 .box 中的高度和宽度,或者需要更改滚动容器的宽度,因为您将大小设置为 300px,将其更改为 500 或更少,并且放置了 4 种颜色的100px 现在我将代码更正为 50px 并且它可以工作。
p {
font-family: Lato;
}
.container {
display: flex;
justify-content: start;
width: 300px;
overflow-x: scroll;
}
.red {
background-color: red;
margin-right: 10px;
flex-shrink: 0;
}
.yellow {
background-color: yellow;
margin-right: 10px;
flex-shrink: 0;
}
.blue {
background-color: blue;
margin-right: 10px;
flex-shrink: 0;
}
.green {
background-color: green;
flex-shrink: 0;
}
.box {
width: 50px;
height: 50px;
}
- 2 回答
- 0 关注
- 114 浏览
添加回答
举报