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
display: flex; // 变成容器
justify-content: 水平对齐方式 align-items: 垂直对齐方式 flex-direction:坐标方向;4个值,row | row-reverse | column | column-reverse flex-wrap:nowarp默认一行 wrap多行,reverse方向相反
不常见: flex-flow: 是direction和wrap的简写 align-content:配合flex-wrap多行形式使用
flex-grow: 默认值是0;可以理解成占用额外空间的比例 flex-shrink: 默认1;flex元素默认宽度大于容器宽度时生效,值越大缩得越厉害; flex-basis:在空白分配前的默认尺寸,初始大小;
flex缩写[grow, shrink, basis]: 默认值是: initial => 0 1 auto; flex: auto => flex: 1 1 auto; flex: <positive-number> => flex: <positive-number> 1 0px; flex: <positive-number> <basis> => <positive-number> <positive-number> <basis>
<positive-number>
flex: <positive-number> 1 0px
<positive-number> <basis>
<positive-number> <positive-number> <basis>
order:可以控制显示顺序
align-self:垂直对齐方向
左边:flex: 1; 右侧:width: 100px;
https://css-tricks.com/snippets/css/a-guide-to-flexbox/ https://www.zhangxinxu.com/wordpress/2019/12/css-flex-basis/
The text was updated successfully, but these errors were encountered:
常见问题:容器和子元素都有哪些属性,默认值是什么
Sorry, something went wrong.
No branches or pull requests
容器属性
display: flex; // 变成容器
justify-content: 水平对齐方式
align-items: 垂直对齐方式
flex-direction:坐标方向;4个值,row | row-reverse | column | column-reverse
flex-wrap:nowarp默认一行 wrap多行,reverse方向相反
不常见:
flex-flow: 是direction和wrap的简写
align-content:配合flex-wrap多行形式使用
子元素属性
flex-grow: 默认值是0;可以理解成占用额外空间的比例
flex-shrink: 默认1;flex元素默认宽度大于容器宽度时生效,值越大缩得越厉害;
flex-basis:在空白分配前的默认尺寸,初始大小;
flex缩写[grow, shrink, basis]:
默认值是: initial => 0 1 auto;
flex: auto => flex: 1 1 auto;
flex:
<positive-number>
=>flex: <positive-number> 1 0px
;flex:
<positive-number> <basis>
=><positive-number> <positive-number> <basis>
order:可以控制显示顺序
align-self:垂直对齐方向
常用布局
左边填满 右边定宽
左边:flex: 1;
右侧:width: 100px;
参考资料
https://css-tricks.com/snippets/css/a-guide-to-flexbox/
https://www.zhangxinxu.com/wordpress/2019/12/css-flex-basis/
The text was updated successfully, but these errors were encountered: