【问题标题】:Background color css not working in safari背景颜色css在Safari中不起作用
【发布时间】:2021-05-03 16:45:38
【问题描述】:

作为顶部的图像,Safari 中的背景是银色。但它在其他浏览器(chrome 和 firefox)上运行良好

这里是代码

HTML:

<a type="button" class="btn btn-danger">Pesan a Sekarang</a>

CSS:

我已经尝试过rgba 和rgb,但还是不行。

所以这是 safari 的错误还是什么? 因为我已经阅读了Background color CSS not working in safari but working fine in Chrome, Firefox,但仍然无法正常工作

background-color: #e5131d!important;
border-color: #e5131d!important;

这里是 CSS

background-color: #e5131d!important;border-color: #e5131d!important;

【问题讨论】:

  • 请提供您的代码而不是您的代码图像
  • [link]stackoverflow.com/help/minimal-reproducible-example 将帮助您提供我们需要的帮助。特别是请提供相关的 HTML 和 CSS,并将整个内容放在一个 sn-p 中,以便我们可以轻松尝试。
  • @Sfili_81 我刚刚更新了代码

标签: css safari


【解决方案1】:
<a type="button" class="btn btn-danger" href="#">{!! __('landingpage.button.details') !!}</a>

问题是我使用了一个带有属性类型按钮的标签元素

然后我变成这样

<a href="#"><button type="button" class="btn btn-danger">text</button></a>

它在 safari 上对我有用

【讨论】:

  • 搜索了几个小时后,这就是我们要寻找的答案!谢谢你,你让我的星期一! a标签上的'type='button'是问题所在。
【解决方案2】:

尝试使用 background:#e5131d 代替。您可能使用背景设置了银色一套,这可能会覆盖背景颜色

您也可以使用之前的父元素类作为解决方法

.parent .btn-danger{背景:#e5131d}

避免!重要

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-06-11
    • 1970-01-01
    • 2021-05-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多