【问题标题】:SCSS - Is there any way to override inline styling without the usage of !important?SCSS - 有没有办法在不使用 !important 的情况下覆盖内联样式?
【发布时间】:2022-01-30 08:33:38
【问题描述】:

我正在尝试覆盖我的 SCSS 文件中的内联样式。 但是,由于我们使用的是 AMP,所以我不能使用 !important。

现在我想知道是否有任何方法可以在不使用 !important 的情况下覆盖内联样式?

【问题讨论】:

  • 不,没有其他方法可以推翻它。

标签: sass


【解决方案1】:

不,没有 !important 就无法推翻它。这是因为内联样式总是优先考虑,除非被 !important 否决。

如果您必须删除内联样式并且无法更新 HTML,您可以使用 .removeAttribute("style") 使用 JavaScript 删除内联样式。

您可以阅读更多关于 CSS Precedence here

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-02-06
    • 2019-06-29
    • 1970-01-01
    • 2020-07-10
    • 2018-05-05
    • 2013-01-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多