为什么CSS:link on active不能使当前页面链接突出显示? [英] Why CSS :active on link doesn't make the current page link highlighted?

查看:50
本文介绍了为什么CSS:link on active不能使当前页面链接突出显示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在下面的代码中列出了进入母版页的

I have the following code below for list into master page

<div id="header">
            <ul>
                <li><a href="default.aspx">Home</a></li>
                <li><a href="page1.aspx">Page1</a></li>

            </ul>
        </div>       ​

使用CSS

#header a:hover {
    color: #AA1111;
    border-color: #AA1111;
}

#header a:active {
    color: #AA1111;
    border-color:#AA1111;
}

,但是当页面处于活动状态时,链接不会用颜色突出显示.

but the link doesn't highlight with color when page is actived .

推荐答案

:active 并不表示当前页面处于活动状态时,链接将突出显示.

:active does not indicate that the link will be highlighted when the current page is active.

:active 是鼠标单击与链接上释放的鼠标之间的链接状态.尝试在链接上按住鼠标以进行查看.

:active is the state of the link between mouse click and mouse released on the link. Try holding your mouse down on the link to see for yourself.

要以不同的样式设置当前页面的链接,您需要为当前页面链接提供不同的类,然后在CSS中定位该类.

To set the current page's link in a different style you will need to either give the current page link a different class and target that class in your CSS.

如果您使用的是.NET,我建议使用各种CSS菜单适配器/列表控件,它们可以指定当前页面菜单链接类.

If you're using .NET I recommend using the various CSS menu adapters / list controls that have the option of specifying the current page menu link class.

这篇关于为什么CSS:link on active不能使当前页面链接突出显示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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