[英]Flexbox not working in Safari and IOS
I have made a responsive flexbox grid. 我已经制作了一个响应式flexbox网格。 It works in Chrome, but not in Safari and IOS.
它适用于Chrome,但不适用于Safari和IOS。 I must be missing something.
我肯定错过了什么。 Can anyone tell me what I'm doing wrong?
谁能告诉我我在做什么错?
section {
max-width: 1280px;
display: block;
margin: 0 auto;
}
section:not(.grid) {
.wrapper {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
-webkit-box-pack: start;
-ms-flex-pack: start;
justify-content: flex-start;
}
.box {
-webkit-box-flex: 1;
-webkit-flex: 1 1 12em;
-ms-flex: 1 1 12em;
flex: 1 1 12em;
}
}
.wrapper {
display: -ms-grid;
display: grid;
-ms-grid-columns: (minmax(12em, 1fr))[auto-fill];
grid-template-columns: repeat(auto-fill, minmax(12em, 1fr));
}
.box {
padding-right: 1em;
}
.box:last-of-type {
padding-right: 0;
}
Remove this enclosing element from your SCSS, but keep everything inside it: 从SCSS中删除此封闭元素,但将所有内容保留在其中:
section:not(.grid) {}
it means those flex styles will NOT be applied. 这意味着这些弹性样式将不会应用。
section { max-width: 1280px; display: block; margin: 0 auto; border: 1px dashed red; } .wrapper { display: -webkit-box; display: -ms-flexbox; display: flex; -ms-flex-wrap: wrap; flex-wrap: wrap; -webkit-box-pack: start; -ms-flex-pack: start; justify-content: flex-start; } .box { -webkit-box-flex: 1; -webkit-flex: 1 1 12em; -ms-flex: 1 1 12em; flex: 1 1 12em; border: 1px dashed blue; } .wrapper { display: -ms-grid; display: grid; -ms-grid-columns: (minmax(12em, 1fr))[auto-fill]; grid-template-columns: repeat(auto-fill, minmax(12em, 1fr)); } .box { padding-right: 1em; } .box:last-of-type { padding-right: 0; }
<section class="grid"> <h4>All projects</h4> <div class="wrapper"> <div class="box"> <h5>Project 1<br> <span>Category</span> </h5> </div> <div class="box"> <h5>Project 2<br> <span>Category</span> </h5> </div> <div class="box"> <h5>Project 3<br> <span>Category</span> </h5> </div> <div class="box"> <h5>Project 4<br> <span>Category</span> </h5> </div> <div class="box"> <h5>Project 5<br> <span>Category</span> </h5> </div> <div class="box"> <h5>Project 6<br> <span>Category</span> </h5> </div> </div> </section>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.