css - flex : 1 mean? 是什么

标签 css flexbox

众所周知,flex属性是flex-growflex-shrink的简写flex-basis 属性。它的默认值为0 1 auto,即

flex-grow: 0;
flex-shrink: 1;
flex-basis: auto;

但我注意到,在很多地方都使用了 flex: 1。它是 1 1 auto 还是 1 0 auto 的简写?我不明白这意味着什么,当我用谷歌搜索时我什么也得不到。

最佳答案

flex: 1 表示如下:

flex-grow : 1;    ➜ The div will grow in same proportion as the window-size       
flex-shrink : 1;  ➜ The div will shrink in same proportion as the window-size 
flex-basis : 0;   ➜ The div does not have a starting value as such and will 
                     take up screen as per the screen size available for
                     e.g:- if 3 divs are in the wrapper then each div will take 33%.

关于css - flex : 1 mean? 是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54727060/

相关文章:

javascript - 使用 css2 的 Masonry 样式以获得更好的浏览器兼容性

css - flex 的 child 的 child 占据了所有的空间

html - 当大于动态宽度父级时, flex 元素上的滚动条

css - 如何使用flexbox将两个元素设置为彼此相邻

jquery - 光滑的旋转木马 : Display all items on centerMode

html - 重置一个元素及其子元素的所有 CSS

javascript - 当 div 改变大小时,如何修复 div 内图像的布局?

jquery - 显示 div 时出现部分边框

html - CSS flexbox "align-items: flex-end;"不适用于图像

html - Flexbox 中心和右下角的元素