【发布时间】:2015-06-16 06:00:58
【问题描述】:
问题是在 IE10 中,行内列的宽度计算错误,它似乎是在列边距的宽度上添加(总共 80 像素),但在 Firefox 和 Chrome 中它计算得很好并适合 1260px 内的所有内容。主要问题是我以我认为正确的方式为所有内容添加了前缀,但我仍然遇到了问题。
你可以在 jsFiddle 上看到它 - http://jsfiddle.net/andyjh07/ue2zfga6/
CSS:
.row {
width: 100%;
position: relative;
background: red;
display: box;
display: -webkit-flex;
display: -moz-flex;
display: -ms-flexbox;
display: flex;
box-orient: vertical;
-webkit-flex-direction: column;
-moz-flex-direction: column;
flex-direction: column;
-ms-flex-direction: column;
margin-bottom: 40px; }
.row:after {
content: "";
display: table;
clear: both; }
.row *[class^="col-"] {
position: relative;
display: block;
height: auto; }
.row *[class^="col-"]:first-child {
margin-left: 0; }
@media (min-width: 64em) {
.row {
box-orient: horizontal;
-webkit-flex-direction: row;
-moz-flex-direction: row;
flex-direction: row;
-ms-flex-direction: row; } }
@media (min-width: 78.75em) {
.row {
max-width: 78.75em;
margin: 0 auto; } }
.col-one-third {
width: 100%;
background: blue; }
@media (min-width: 64em) {
.col-one-third {
width: 33.3%;
margin-left: 40px; } }
.col-two-thirds {
width: 66.7%;
margin-left: 40px;
background: blue; }
它在 Chrome、IE11、Firefox 上的外观
它在 IE 10 上的外观,在 IE11 的开发控制台/工具中模拟
如您所见,边距被添加并超出了容器的宽度
【问题讨论】:
-
您是否查看编译后的 CSS 以查看它是否正在生成您期望的结果?这里的 Sass 代码是无关紧要的,因为它永远不会提供给浏览器。
-
我当然看了,这就是重点。编译后的 css 为everying 加上前缀。我也将编译的部分添加,以便您查看
-
我已添加它,以便您查看。如前所述,它适用于 Firefox 和 Chrome,只是 ie10 有问题。然而,这是在模拟器中运行的
-
无法重现或我没有正确理解您的问题。您能否附上错误和预期行为的屏幕截图。
-
@phts 2 秒我会得到一对