Firefox中CSS网格布局的不规则子宽度错误
我正在尝试为我的卡片构建相等的列,但我的解决方案在Firefox中不起作用,而在Chrome中起作用 我的代码:Firefox中CSS网格布局的不规则子宽度错误,css,grid,css-grid,Css,Grid,Css Grid,我正在尝试为我的卡片构建相等的列,但我的解决方案在Firefox中不起作用,而在Chrome中起作用 我的代码: .grid { display: grid; width: 1170px; grid-template-columns: repeat(2, 1fr); grid-gap: 15px; @include breakpoint(xs) { grid-template-columns: repeat(3, 1fr); }
.grid {
display: grid;
width: 1170px;
grid-template-columns: repeat(2, 1fr);
grid-gap: 15px;
@include breakpoint(xs) {
grid-template-columns: repeat(3, 1fr);
}
@include breakpoint(sm) {
grid-template-columns: repeat(4, 1fr);
}
@include breakpoint(lg) {
grid-template-columns: repeat(5, 1fr);
}
}
.card {
display: flex;
flex-direction: column;
min-width: 0;
}
铬结果(良好):
Firefox结果(错误):
您是否尝试过以下CSS
.card {
display: flex;
-ms-flex-direction: column;
-webkit-flex-direction: column;
flex-direction: column;
min-width: 0;
}
你的代码似乎对我有用。可能是你的卡片中的html元素不同
你能用完整的代码(HTML
&CSS
)做一支笔,这样我们就能更好地帮助你了吗
您可以尝试为整个css添加前缀吗?您是否尝试过以下css
.card {
display: flex;
-ms-flex-direction: column;
-webkit-flex-direction: column;
flex-direction: column;
min-width: 0;
}
你的代码似乎对我有用。可能是你的卡片中的html元素不同
你能用完整的代码(HTML
&CSS
)做一支笔,这样我们就能更好地帮助你了吗
您可以尝试在整个css前加前缀吗?可能是这样的:(但无法确定,因为问题中没有足够的代码来重现问题)它不起作用。我试过使用percentatges,但我更喜欢使用分数而不是percentatges。可能是这样的:(但不能确定,因为问题中没有足够的代码来重现问题)它不起作用。我试过使用percentatges,但我更喜欢使用分数而不是percentatges。我最终发现了问题,我的网格中有一个js生成的html元素。很高兴听到这个消息!如果我有任何帮助,请投票。:)我终于发现了问题,在我的网格中有一个js生成的html元素。很高兴听到这个消息!如果我有任何帮助,请投票。:)