【问题标题】:Why I Am Unable to Remove Text-decoration-style from Underline to None?为什么我无法将 Text-decoration-style 从下划线删除为无?
【发布时间】:2018-02-26 18:52:24
【问题描述】:

当我尝试在本地服务器上运行此代码时,我收到此错误。我已经在代码中提到了 text-decoration-style: none; 我将文本装饰作为下划线,我想删除它。

<style>
    li {
        list-style-type: none;
        text-decoration-style: none;
        display: inline-block;
        color: white;
        padding: 20px;
        margin-left: 20px;
    }

    .navbar {
        max-width: 100%;
        background-color: black;
    }
</style>

Image of the Error where m getting error.

【问题讨论】:

  • li a { text-decoration: none; }
  • 此代码无效。顺便说一句,感谢您给我一些时间。

标签: html css


【解决方案1】:

如果您在li 中使用锚点&lt;a&gt;,那么您应该将其应用于a 而不是li

.navbar ul li a{
    text-decoration: none;
}

【讨论】:

    【解决方案2】:

    text-decoration-style: none; 语法错误,您应该改用text-decoration-style: unset; 更好的方法是使用 text-decoration: none;

    Internet Explorer/EdgeSafari 也不支持 text-decoration-style 属性。

    更多用法和语法请查看article

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-05-14
      • 1970-01-01
      • 2019-03-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多