CSS3 Flex 可以只取整数值吗?
Can CSS3 Flex take only integer values?
我经常使用 CSS3 flexboxes - 它们使布局变得简单、灵活。 CSS 沿着
的路线
-webkit-box-flex: 4;
-moz-box-flex: 4;
-ms-flex: 4;
-webkit-flex: 4;
flex: 4;
从来都不是问题。但是,我现在遇到需要提供浮点值的情况。我的意思是
-webkit-box-flex: 4.1;
-moz-box-flex: 4.1;
-ms-flex: 4.1;
-webkit-flex: 4.1;
flex: 4.1;
一个快速而肮脏的实验测试 - 在控制台中对 CSS 进行热编辑,然后在 Chrome 和 Firefox 中使用 PicPick 像素标尺进行宽度测量 - 表明这是可行的。但是,我无法找到任何确定的信息——我尝试了 W3C 文档,但发现它们有点过于密集。永远可靠的 caniuse 也没有完全阐明这一点 - 在这个问题上。有人能告诉我这样的小数是否可以安全地用于当今大多数最新的主流浏览器?
根据 Mozilla 文档,https://developer.mozilla.org/en-US/docs/Web/CSS/flex , it takes a number 值 - 根据 MDN 文档,它包括非整数。所有有效数值:
12 A raw <integer> is also a <number>
4.01 A positive non-integer <number>
-456.8 Negative non-integer <number>
0.0 Zero
+0.0 Zero, with a leading +
-0.0 Zero, with a leading - (Though strange, this is an allowed value)
.60 Digits are optional before the dot
10e3 The scientific notation is allowed
-3.4e-2 Most complex case of scientific notatio
我经常使用 CSS3 flexboxes - 它们使布局变得简单、灵活。 CSS 沿着
的路线-webkit-box-flex: 4;
-moz-box-flex: 4;
-ms-flex: 4;
-webkit-flex: 4;
flex: 4;
从来都不是问题。但是,我现在遇到需要提供浮点值的情况。我的意思是
-webkit-box-flex: 4.1;
-moz-box-flex: 4.1;
-ms-flex: 4.1;
-webkit-flex: 4.1;
flex: 4.1;
一个快速而肮脏的实验测试 - 在控制台中对 CSS 进行热编辑,然后在 Chrome 和 Firefox 中使用 PicPick 像素标尺进行宽度测量 - 表明这是可行的。但是,我无法找到任何确定的信息——我尝试了 W3C 文档,但发现它们有点过于密集。永远可靠的 caniuse 也没有完全阐明这一点 - 在这个问题上。有人能告诉我这样的小数是否可以安全地用于当今大多数最新的主流浏览器?
根据 Mozilla 文档,https://developer.mozilla.org/en-US/docs/Web/CSS/flex , it takes a number 值 - 根据 MDN 文档,它包括非整数。所有有效数值:
12 A raw <integer> is also a <number>
4.01 A positive non-integer <number>
-456.8 Negative non-integer <number>
0.0 Zero
+0.0 Zero, with a leading +
-0.0 Zero, with a leading - (Though strange, this is an allowed value)
.60 Digits are optional before the dot
10e3 The scientific notation is allowed
-3.4e-2 Most complex case of scientific notatio