简体   繁体   English

如何在悬停时从名称中删除下划线

[英]How to remove underline from a name on hover

I have such html:我有这样的html:

<legend class="green-color"><a name="section1">Section</a></legend>

legend.green-color{
    color:green;
}

In my case Section looking green, but when i put mouse pointer on it it became looking like an a href, but i want it stay just the same without underline and changing color.在我的情况下, Section看起来是绿色的,但是当我将鼠标指针放在上面时,它看起来像一个 href,但我希望它保持不变,没有下划线和改变颜色。

Is it possible to achieve without changing css or with minimum css cahnge?是否可以在不更改 css 或使用最小 css 更改的情况下实现?

or may be somehow with jquery?或者可能以某种方式使用jquery?

try this:试试这个:

legend.green-color a:hover{
    text-decoration: none;
}

删除锚标记的文本装饰

<a name="Section 1" style="text-decoration : none">Section</a>

You can use CSS under legend.green-color a:hover to do it.您可以使用legend.green-color a:hover下的CSS 来完成。

legend.green-color a:hover {
    color:green;
    text-decoration:none;
}

To keep the color and prevent an underline on the link:要保持颜色并防止链接上有下划线:

legend.green-color a{
    color:green;
    text-decoration: none;
}

You can assign an id to the specific link and add CSS.您可以为特定链接分配一个 id 并添加 CSS。 See the steps below:请参阅以下步骤:

1.Add an id of your choice (must be a unique name; can only start with text, not a number): 1.添加您选择的id(必须是唯一的名称;只能以文本开头,不能以数字开头):

<a href="/abc/xyz" id="smallLinkButton">def</a>
  1. Then add the necessary CSS as follows:然后添加必要的 CSS,如下所示:

     #smallLinkButton:hover,active,visited{ text-decoration: none; }

 legend.green-color{ color:green !important; }

In react you need to do thisreact你需要这样做

<Link to="/" style={{ textDecoration: 'none' }}>
....
</Link>

or if you are using bootstrap in react then use this class或者如果您在react中使用bootstrap ,请使用此类

className="text-decoration-none"

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

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