Flexbox可以在Firefox上运行,但不能在Edge上运行吗?

乌伊瓦尔·萨克森纳

我正在从事前端导师项目的页脚。相同的HTML和CSS在Firefox和Edge上生成不同的页面。Firefox是正确的一种。你能解释为什么会这样吗?我在代码后附加了结果。

@import url("https://fonts.googleapis.com/css2?family=Bai+Jamjuree:wght@400;600&display=swap");
html {
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
}

*,
*:before,
*:after {
  -webkit-box-sizing: inherit;
  box-sizing: inherit;
}

body {
  margin: 0;
  padding: 0;
  font-size: 1rem;
  line-height: 1.3;
  font-family: "Bai Jamjuree", sans-serif;
  color: #9fabb2;
}

p.medium {
  font-size: 1rem;
  line-height: 1.5;
}

@media (min-width: 1000px) {
  p.medium {
    font-size: 1.125rem;
    line-height: 1.75;
  }
}

a {
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

footer {
  background-color: #f6f7f9;
  margin-top: calc(100vh - 150px);
}

footer .footer_logo {
  height: 57px;
  width: 57px;
}

footer .footer {
  height: 150px;
}

footer .footer__container {
  display: grid;
  grid-template-columns: 1fr 4fr 1fr;
  max-width: 1110px;
  margin: auto;
}

footer .col-1 {
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

footer .col-3 {
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

footer .col-3 img {
  margin-right: 24px;
}

.col-2 {
  border: 1px solid red;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

.col-2 .link {
  border: 1px solid blue;
  display: flex;
  align-items: end;
  display: -webkit-box;
  -webkit-box-align: end;
}

.col-2 a {
  border: 1px solid green;
}
<!-- Footer -->
<footer>
  <div class="footer footer__container">
    <div class="col-1">
      <img class="footer_logo" src="logo.svg">
    </div>
    <div class="col-2">
      <div class="link">
        <a href="#">FAQs</a>
      </div>
      <div class="link">
        <a href="#">Privacy Policy</a>
      </div>
      <div class="link">
        <a href="#">Install Guide</a>
      </div>
      <div class="link">
        <a href="#"></a>
        <!--This is supposed to be empty-->
      </div>
      <div class="link">
        <a href="#">Conatct Us</a>
      </div>
      <div class="link">
        <a href="#">Press Kit</a>
      </div>
    </div>
    <div class="col-3">
      <img src="icon-facebook.svg">
      <img src="icon-twitter.svg">
      <img src="icon-instagram.svg">
    </div>
  </div>
</footer>
<!-- Footer Ends-->

火狐浏览器

在此处输入图片说明

边缘

在此处输入图片说明

我在CSS selctor中观察到,.col-2 .link如果添加:

.col-2 .link {
  border: 1px solid blue;
  display: flex;
  align-items: end;
  display: -webkit-box;      <------------   *THIS LINE AND*
  -webkit-box-align: end;    <------------   *THIS LINE HERE* 
}

然后,Edge也使网页与Firefox相同。

为什么是样式

display: flex;
align-items: end;

不在边缘工作

迈克尔·本杰明

归结为:align-items: endFirefox支持,但Edge不支持。

您仍然需要使用align-items: flex-end完整的跨浏览器支持。


这是有问题的代码块:

.col-2 .link {
  border: 1px solid blue;
  display: flex;
  align-items: end;
  display: -webkit-box;
  -webkit-box-align: end;
}

In a declaration block, the cascade will pick the last property, when the property is declared multiple times.

So display: flex is ignored because the cascade will settle on display: -webkit-box.

For cross axis alignment, -webkit-box-align: end works in both Firefox and Edge.


No prefixes are needed. Both Firefox and Edge support Flex Layout.

The problem is actually quite simple to fix, and it has nothing to do with prefixes.

  • align-items: end is supported by Firefox, but not Edge.
  • You still need to use align-items: flex-end for full cross-browser support.

end值是CSS Box Alignment Module的功能,主要浏览器尚未完全支持。因此,请使用CSS弹性盒布局模块中flex-end定义的特定值带有前缀“ flex-”的值最终将被淘汰,但目前显然仍然有必要。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

Flexbox可以在Firefox上运行,但不能在Edge上运行吗?

来自分类Dev

Flexbox可以在Firefox上运行,但不能在Edge上运行吗?

来自分类Dev

网站可以在Chrome上运行,但不能在Firefox上运行吗?

来自分类Dev

jQuery可以在计算机上运行,但不能在iPad上运行吗?

来自分类Dev

mediaElement可在Chrome上运行,但不能在Firefox或Edge上运行(网络音频api / angularJS)

来自分类Dev

用户脚本通知可以在Chrome上运行,但不能在Firefox上运行?

来自分类Dev

拖放可以在IE上正常运行,但不能在Chrome / Firefox中运行

来自分类Dev

Kubernetes不能在Intel上运行吗?

来自分类Dev

JavaScript警报可以在Firefox上正常运行,但不能在Chrome和资源管理器中运行

来自分类Dev

HTML5动画可在Chrome上运行,但不能在Firefox上运行

来自分类Dev

转换比例可在Chrome上运行,但不能在Firefox上运行

来自分类Dev

HTML5动画可在Chrome上运行,但不能在Firefox上运行

来自分类Dev

媒体查询可在移动Firefox上运行,但不能在移动Chrome上运行

来自分类Dev

Object.map lambda 代码可以在 Chrome、Firefox 中运行,但不能在 IE 中运行吗?

来自分类Dev

CMake可以在Mac上运行,但不能在Linux上运行?

来自分类Dev

更改某些值后,iframe可以在chrome上运行,但不能在mozilla上运行

来自分类Dev

为什么sudo可以在Linux上运行但不能在Android上运行?

来自分类Dev

测试的顺序可以在python 2上完美运行,但不能在python 3上完美运行

来自分类Dev

WebDriver可以在Chrome上运行,但不能在Internet Explorer上运行

来自分类Dev

脚本可以在CentOS上正常运行,但不能在RHEL5上运行

来自分类Dev

jQuery代码可以在localhost上正常运行,但不能在服务器上运行

来自分类Dev

更改某些值后,iframe可以在chrome上运行,但不能在mozilla上运行

来自分类Dev

Java提示可以在Windows上运行,但不能在Ubuntu上运行

来自分类Dev

Matlab不能在ubuntu 16.04上运行吗?

来自分类Dev

applicationWillTerminate和applicationShouldTerminate不能在macOS上运行吗?

来自分类Dev

Matlab不能在ubuntu 16.04上运行吗?

来自分类Dev

为什么带有flex的HTML圣杯可以在Chrome上运行,而不能在Firefox上运行?

来自分类Dev

控制器可以在本地正常运行,但不能在heroku上运行

来自分类Dev

LibGDX游戏可以在桌面上正常运行,但不能在Android设备上运行

Related 相关文章

  1. 1

    Flexbox可以在Firefox上运行,但不能在Edge上运行吗?

  2. 2

    Flexbox可以在Firefox上运行,但不能在Edge上运行吗?

  3. 3

    网站可以在Chrome上运行,但不能在Firefox上运行吗?

  4. 4

    jQuery可以在计算机上运行,但不能在iPad上运行吗?

  5. 5

    mediaElement可在Chrome上运行,但不能在Firefox或Edge上运行(网络音频api / angularJS)

  6. 6

    用户脚本通知可以在Chrome上运行,但不能在Firefox上运行?

  7. 7

    拖放可以在IE上正常运行,但不能在Chrome / Firefox中运行

  8. 8

    Kubernetes不能在Intel上运行吗?

  9. 9

    JavaScript警报可以在Firefox上正常运行,但不能在Chrome和资源管理器中运行

  10. 10

    HTML5动画可在Chrome上运行,但不能在Firefox上运行

  11. 11

    转换比例可在Chrome上运行,但不能在Firefox上运行

  12. 12

    HTML5动画可在Chrome上运行,但不能在Firefox上运行

  13. 13

    媒体查询可在移动Firefox上运行,但不能在移动Chrome上运行

  14. 14

    Object.map lambda 代码可以在 Chrome、Firefox 中运行,但不能在 IE 中运行吗?

  15. 15

    CMake可以在Mac上运行,但不能在Linux上运行?

  16. 16

    更改某些值后,iframe可以在chrome上运行,但不能在mozilla上运行

  17. 17

    为什么sudo可以在Linux上运行但不能在Android上运行?

  18. 18

    测试的顺序可以在python 2上完美运行,但不能在python 3上完美运行

  19. 19

    WebDriver可以在Chrome上运行,但不能在Internet Explorer上运行

  20. 20

    脚本可以在CentOS上正常运行,但不能在RHEL5上运行

  21. 21

    jQuery代码可以在localhost上正常运行,但不能在服务器上运行

  22. 22

    更改某些值后,iframe可以在chrome上运行,但不能在mozilla上运行

  23. 23

    Java提示可以在Windows上运行,但不能在Ubuntu上运行

  24. 24

    Matlab不能在ubuntu 16.04上运行吗?

  25. 25

    applicationWillTerminate和applicationShouldTerminate不能在macOS上运行吗?

  26. 26

    Matlab不能在ubuntu 16.04上运行吗?

  27. 27

    为什么带有flex的HTML圣杯可以在Chrome上运行,而不能在Firefox上运行?

  28. 28

    控制器可以在本地正常运行,但不能在heroku上运行

  29. 29

    LibGDX游戏可以在桌面上正常运行,但不能在Android设备上运行

热门标签

归档