博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
flexbox_Flexbox中的Flex基础属性
阅读量:2527 次
发布时间:2019-05-11

本文共 2481 字,大约阅读时间需要 8 分钟。

flexbox

弹性基础 (Flex Basis)

The flex-basis property defines the size of the flex-item along the main axis of the flex container. The main axis is horizontal if flex-direction is set to row and it’ll be vertical if the flex-direction property is set to column.

flex-basis属性定义沿flex容器的主轴的flex-item的大小。 如果flex-direction设置为row ,则主轴为水平轴;如果flex-direction属性设置为column ,则主轴为垂直轴。

句法 (Syntax)

flex-basis: auto | content | 
|
;

flex-basis:自动 (flex-basis: auto)

flex-basis: auto looks up the main size of the element and defines the size. For example, on a horizontal flex container, auto will look for width and height if the container axis is vertical.

flex-basis: auto查找元素的主要尺寸并定义尺寸。 例如,在水平伸缩容器上,如果容器的轴是垂直的,则auto将查找widthheight

If no size is specified, auto will fall back to content.

如果未指定大小,则auto将退回到content

flex-basis:内容 (flex-basis: content)

flex-basis: content resolves the size based on the element’s content, unless width or height is set through normal box-sizing.

flex-basis: content除非元素的widthheight是通过常规box-sizing设置的,否则content会根据元素的flex-basis: content解析box-sizing

In both the cases where flex-basis is either auto or content, if main size is specified, that size will take priority.

flex-basisautocontent两种情况下,如果指定了main size,则以该大小flex-basis

flex-basis: (flex-basis:)

This is just as specifying width or height, but only more flexible. flex-basis: 20em; will set the initial size of the element to 20em. Its final size will be based on available space, flex-grow multiple and flex-shrink multiple.

就像指定widthheight ,但是更加灵活。 flex-basis: 20em; 将元素的初始大小设置为20em 。 其最终大小将取决于可用空间, flex-grow倍数和flex-shrink倍数。

The specification suggests use of flex shorthand property. This helps write flex-basis along with flex-grow and flex-shrink properties.

该规范建议使用flex速记属性。 这有助于编写flex-basis以及flex-growflex-shrink属性。

例子 (Examples)

Here is rows of individual flex containers and individual flex elements showing how flex-basis affects the box-sizing.

这是单个flex容器和单个flex元素的行,它们显示flex-basis如何影响box-sizing

When the flex-direction is column, the same flex-basis will control the height property. You can see it in the example below:

flex-directioncolumn ,相同的flex-basis将控制height属性。 您可以在以下示例中看到它:

更多信息: (More Information:)

You can fund additional references about the flex basis property on the following pages:

您可以在以下页面上为有关弹性基准属性的其他参考提供资金:

  • CSS specification

    CSS规范

  • Mozilla Developer Network page on

    Mozilla开发人员网络页面

有关Flexbox的更多信息: (More info on Flexbox:)

翻译自:

flexbox

转载地址:http://wcuzd.baihongyu.com/

你可能感兴趣的文章
一个update的小故事
查看>>
OutPut子句的使用限制
查看>>
C# 获取存储过程 返回的参数Output
查看>>
10、WGET
查看>>
问题解决-某些项目因位于工作空间目录中而被隐藏 & 如何解决java项目导入出错:与另一项目重叠...
查看>>
[LeetCode&Python] Problem 455. Assign Cookies
查看>>
Java发送邮件时标题和发件人乱码
查看>>
TextView & EditText
查看>>
HDU-4474 Yet Another Multiple Problem BFS搜索
查看>>
idea使用svn提交时出现错误Warning not all local changes may be shown due to an error
查看>>
实现Icommand接口
查看>>
多用户ATM机(面向对象编程)
查看>>
Linux下管理软件的方法
查看>>
隐藏DIV 显示DIV
查看>>
[JAVA算法]递归求Fibbonicc序列方法
查看>>
@+id/和android:id的区别
查看>>
在Windows上安装FFmpeg程序
查看>>
jQuery 解决 IE 6/7/8 BUG:下拉框select设宽度时option超出显示不全
查看>>
15 个有趣的 JavaScript 与 CSS 库
查看>>
实现iOS语言本地化/国际化
查看>>