为什么我无法定位此类中的链接? [英] Why can't I target the links in this class?

查看:126
本文介绍了为什么我无法定位此类中的链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个类:

.search-modal-navigation-link {
    font-family: Arial, Helvetica, sans-serif;
    font-weight: bold;
    color: #FFF;
    height: 32px;
    font-size: 12px;
    text-align: center;
    float: left;
    margin-right: 22px;
}



我试着定位这个类中的所有链接, p>

And I tried targeting all links in this class so I did this:

a.search-modal-navigation-link:link {
    text-decoration: underline; 
    color: red;
}

我没有什么,为什么?谢谢:))!

and I get nothing, why is this? Thank you :))!

编辑:我的Html

 <div class="search-modal-navigation-tab">
    <div class="search-modal-navigation-link"><a href="#">
    <img src="img/icons/01-passive.png" width="20" height="21" border="0" /><BR />
    All Events</a></div>
    <div class="search-modal-navigation-link">
    <img src="img/icons/01-passive.png" width="20" height="21" /><BR />
    All Events</div>

  </div>


推荐答案

您的选择器不是在元素中寻找链接与该类,它正在寻找链接该类。您需要将其更改为:

Your selector isn't looking for links in an element with that class, it's looking for links with that class. You need to change it to this:

.search-modal-navigation-link a:link {
    text-decoration: underline; 
    color: red;
}

这篇关于为什么我无法定位此类中的链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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