We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
为指定宽度的元素设置 flex: none
flex: none 是 flex: 0 0 auto 的简写。
0: flex-grow: 0 表示放大比例为 0,有剩余空间也不放大
0: flex-shrink: 0 表示缩小比例为 0,表示空间不足,也不缩小
auto: flex-basis: auto 表示分配多余空间之前,项目占据的主轴空间,auto 即项目本来的大小
与之对应的还有 flex: auto ,即 flex: 1 1 auto。 会随着空间放大缩小
The text was updated successfully, but these errors were encountered:
包含了图片的容器设置了flex
.container { width: 6.4rem; height: 2rem; box-sizing: border-box; display: flex; .img { width: 2rem; height: 2rem; border-radius: 0.2rem; } }
flex 布局默认不换行,所以宽度不够的时候,元素会被挤
让要固定宽高的元素不会变形
.img { width: 2rem; height: 2rem; border-radius: 0.2rem; flex: none; // 或者 flex: 0 0 auto }
Sorry, something went wrong.
No branches or pull requests
为指定宽度的元素设置 flex: none
flex: none 是 flex: 0 0 auto 的简写。
0: flex-grow: 0 表示放大比例为 0,有剩余空间也不放大
0: flex-shrink: 0 表示缩小比例为 0,表示空间不足,也不缩小
auto: flex-basis: auto 表示分配多余空间之前,项目占据的主轴空间,auto 即项目本来的大小
与之对应的还有 flex: auto ,即 flex: 1 1 auto。 会随着空间放大缩小
The text was updated successfully, but these errors were encountered: