单击时更改锚点的颜色 [英] Change color of an anchor when clicked

查看:57
本文介绍了单击时更改锚点的颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望当我单击此链接时,其颜色会更改为给定的颜色

i want that when i click this link its color changes to the given color

<li id="press"><a href="<?=base_url()?>index.php/page/press">Press</a></li>

推荐答案

CSS声明:active 将完​​成您要执行的任务. http://www.w3schools.com/CSS/pr_pseudo_active.asp

The CSS declaration :active will accomplish what you're after. http://www.w3schools.com/CSS/pr_pseudo_active.asp

示例.

a:active {
    color: #C00;
}

NB.

a:active 必须在CSS定义中的 a:hover 之后,才能生效!

a:active MUST come after a:hover in the CSS definition in order to be effective!

这篇关于单击时更改锚点的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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