如何删除 link 中的下划线

How remove underline in link in react

如何在 link 子文本的反应中将文本装饰设置为 none? 在我的例子中,此文本带有 'preview-title' 和 'preview-slogan' class。 我尝试将其设置为 app.css

.preview-title, .preview-slogan { text-decoration: none; }

我也对 index.css

中的 a 标签做了同样的事情

a { text-decoration: none; }

还尝试了 textDecorationStyle 到元素 <div className='preview-title' textDecorationStyle="none"> 但这也行不通

在 devtool 中我们看到样式是通过 .css 应用的,但在页面上它仍然带有下划线

请尝试下面给出的 CSS 代码,希望对您有所帮助。您必须设置 !important,因为您正试图覆盖特定元素的预定义样式。

.preview-title{
    text-decoration: none !important;
}

希望对您解决问题有所帮助。

谢谢。

发现了,一定要放在text-decoration: none中app.css,不能放在index.css中。