简体   繁体   English

如何在反应中删除链接中的下划线

[英]How remove underline in link in react

How set text-decoration to none in react of the link child text?如何将 text-decoration 设置为 none 以响应链接子文本? In my case this text with the 'preview-title' and 'preview-slogan' class.在我的情况下,此文本带有“预览标题”和“预览口号”类。 带有反应链接文本的开发工具 I tried set it in app.css我尝试在 app.css 中设置它

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

As well i did that to a tag in index.css同样,我对 index.css 中a标签也这样做a

a { text-decoration: none; }

Also attempted textDecorationStyle to the element <div className='preview-title' textDecorationStyle="none"> But that doesnt work too还尝试了 textDecorationStyle 元素<div className='preview-title' textDecorationStyle="none">但这也不起作用

In devtool we see the style is applied through .css but at the page it still with underline在 devtool 中,我们看到样式是通过 .css 应用的,但在页面上它仍然带有下划线

Please try the below-given CSS code hope it will help you.请尝试下面给出的 CSS 代码,希望对您有所帮助。 You have to set !important because you are trying to override the pre-defined style of the particular element.您必须设置 !important 因为您试图覆盖特定元素的预定义样式。

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

Hope it will help you in solving your issue.希望它能帮助您解决您的问题。

Thanks.谢谢。

发现,必须在app.css中放置text-decoration: none ,而不是在index.css中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM