flexbox 在 Safari 中添加 1px 左边距
flexbox adding 1px left margin in Safari
Safari 在 flexbox 行的第一个元素左侧添加 1px margin/gap 时遇到问题。我在下面附上了问题的图片:
弹性框 css 是:
.equal-height {
display: -webkit-box; /* OLD - iOS 6-, Safari 3.1-6 */
display: -moz-box; /* OLD - Firefox 19- (buggy but mostly works) */
display: -ms-flexbox; /* TWEENER - IE 10 */
display: -webkit-flex; /* NEW - Chrome */
display: flex; /* NEW, Spec - Opera 12.1, Firefox 20+ */
-webkit-flex-direction: row;
-webkit-flex-wrap: wrap;
flex-direction: row;
flex-wrap: wrap;
}
子元素设置如下:
.child-div {
float: left;
display: block;
width: 33.3333%;
box-sizing: border-box;
}
但是我注意到它们是在没有浮点数的情况下计算的
文件:style.css;
行:1028
.row:before, .row:after{
content: " ";
display: table;
}
添加:
width: 100%
现在 "margin" 已经解决了。
您使用的网格系统与 safari 有问题:更改它。
希望对你有所帮助。
它们在计算时没有浮点数的原因是 flex
取消了它们。
根据 flexbox spec:
float and clear have no effect on a flex item, and do not take it
out-of-flow. However, the float property can still affect box
generation by influencing the display property’s computed value.
按照 Michael 的说法,flex 容器上的 100% 宽度是可以的,但是如果你想要 flexbox,你想要的是:
.child-div {
width: 33.3333%;
box-sizing: border-box;
-webkit-box-flex: 1;
-moz-box-flex: 1;
-webkit-flex: 1 1 auto;
-ms-flex: 1 1 auto;
flex: 1 1 auto;
}
即您需要使用 float 或 flex,但不能同时使用两者。
您可能想看看这个 flexbox generator 以了解 flex 的工作原理。
我也注意到了这一点。以下是对我有用的方法:
.row:before, .row:after {
display: none;
}
Safari 在 flexbox 行的第一个元素左侧添加 1px margin/gap 时遇到问题。我在下面附上了问题的图片:
弹性框 css 是:
.equal-height {
display: -webkit-box; /* OLD - iOS 6-, Safari 3.1-6 */
display: -moz-box; /* OLD - Firefox 19- (buggy but mostly works) */
display: -ms-flexbox; /* TWEENER - IE 10 */
display: -webkit-flex; /* NEW - Chrome */
display: flex; /* NEW, Spec - Opera 12.1, Firefox 20+ */
-webkit-flex-direction: row;
-webkit-flex-wrap: wrap;
flex-direction: row;
flex-wrap: wrap;
}
子元素设置如下:
.child-div {
float: left;
display: block;
width: 33.3333%;
box-sizing: border-box;
}
但是我注意到它们是在没有浮点数的情况下计算的
文件:style.css; 行:1028
.row:before, .row:after{
content: " ";
display: table;
}
添加:
width: 100%
现在 "margin" 已经解决了。
您使用的网格系统与 safari 有问题:更改它。
希望对你有所帮助。
它们在计算时没有浮点数的原因是 flex
取消了它们。
根据 flexbox spec:
float and clear have no effect on a flex item, and do not take it out-of-flow. However, the float property can still affect box generation by influencing the display property’s computed value.
按照 Michael 的说法,flex 容器上的 100% 宽度是可以的,但是如果你想要 flexbox,你想要的是:
.child-div {
width: 33.3333%;
box-sizing: border-box;
-webkit-box-flex: 1;
-moz-box-flex: 1;
-webkit-flex: 1 1 auto;
-ms-flex: 1 1 auto;
flex: 1 1 auto;
}
即您需要使用 float 或 flex,但不能同时使用两者。
您可能想看看这个 flexbox generator 以了解 flex 的工作原理。
我也注意到了这一点。以下是对我有用的方法:
.row:before, .row:after {
display: none;
}