CSS:如何从不直接在锚标签中的链接中删除下划线? [英] CSS: how do I remove the underline from a link that isn't directly in the anchor tag?

查看:133
本文介绍了CSS:如何从不直接在锚标签中的链接中删除下划线?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 < a href =/ admin / menu_bars / select> 
< div class =action_box right>
管理菜单栏
< / div>
< / a>


a .action_box {
text-decoration:none;
}

不工作= \


<你的代码试图删除下划线从div(可能没有一个),而不是链接(这可能是)。只需

  a {
text-decoration:none;
}

将会起作用,但会从所有链接中删除下划线。



如果您需要更具体的链接,请使用

  a class =action_linkhref =/ admin / menu_bars / select> 
< div class =action_box right>
管理菜单栏
< / div>
< / a>


a.action_link {
text-decoration:none;
}

这假设下划线事实上是 -decoration 而不是div上的 border-bottom


<a href="/admin/menu_bars/select">
    <div class="action_box right">
        Manage Menu Bars
    </div>
</a>


a .action_box {
text-decoration: none;
}

doesn't work =\

解决方案

Your code is trying to remove the underline from the div (which probably doesn't have one) rather than the link (which probably does). Simply

a {
text-decoration: none;
}

will work, although that will remove the underline from all links.

If you need to be more specific to that link then use

<a class="action_link" href="/admin/menu_bars/select">
    <div class="action_box right">
        Manage Menu Bars
    </div>
</a>


a.action_link {
text-decoration: none;
}

This assumes that the underline is in fact a text-decoration on the link element and not a border-bottom on the div.

这篇关于CSS:如何从不直接在锚标签中的链接中删除下划线?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆