【问题标题】:Flexbox does not work in Safari, striked out in Web inspectorFlexbox 在 Safari 中不起作用,在 Web 检查器中被删除
【发布时间】:2015-01-25 20:33:45
【问题描述】:

我将display: flexbox 用于包含多个正方形的 div 容器(以使它们水平对齐),它在 Chrome 中运行良好,但在 Safari 8.0 中却不行,它被这样删除:

#grid {
    overflow-x: hidden;
    overflow-y: scroll;

    position: absolute;
    top: 55px;
    left: 415px;
    bottom: 10px;
    right: 10px;

    display: flex;
    justify-content: space-between;
    flex-direction: row;
    flex-wrap: wrap;
}

.square {
    width: 166px;
    height: 185px;
    position: relative;
    cursor: pointer;
    background-size: 166px 125px !important;
    background-repeat: no-repeat !important;
    background: #FFF;
    margin-right: 20px;
    float: left;
}

【问题讨论】:

  • 可能你的样式被其他样式覆盖了?
  • 我尝试向他们添加 !important,但没有运气。下面唯一的另一个是用户代理样式表。
  • Safari 确实支持 flex 在我看到你的网站之前我感觉不对。
  • 这是instadj.com - 视频缩略图网格。
  • 使用前缀 display:-webkit-flex; 猜测可行

标签: css safari flexbox safari-web-inspector


【解决方案1】:

你需要使用前缀所以 safari 支持

#grid {
    overflow-x: hidden;
    overflow-y: scroll;
    position: absolute;
    top: 55px;
    left: 415px;
    bottom: 10px;
    right: 10px;
    display: flex;
    justify-content: space-between;
    flex-direction: row;
    flex-wrap: wrap;
    display: -webkit-flex;
    -webkit-justify-content: space-between;
    -webkit-flex-direction: row;
    -webkit-flex-wrap: wrap;
}

【讨论】:

猜你喜欢
  • 2015-05-12
  • 2015-08-19
  • 2017-09-30
  • 2017-09-28
  • 1970-01-01
  • 2015-10-30
  • 2018-02-15
  • 2018-04-09
  • 2013-12-30
相关资源
最近更新 更多