<分区>
<分区>
我想使用 jQuery 必须在单击超链接时将其更改为粗体,并在单击另一个链接时将其切换回正常。我的网页中有以下链接:
<div id="navigation">
<ul>
<li id="home"><a href="/index.html">Home</a></li>
<li id="test"><a href="/tests.html">Tests</a></li>
<li id="job"><a href="/jobs.html"> Jobs</a></li>
</ul>
</div>
具有以下样式:
#navigation { float:right; white-space:nowrap;}
#navigation ul{ list-style-type: none; line-height:14px; padding-top:20px; float:left; }
#navigation ul li{ float:left; display:inline; border-right:solid 1px #757171; padding-right:8px; margin-right:8px; }
#navigation ul li.last{ margin-right:0; border:0; padding-right:0; }
#navigation ul li a{ color:#fff; text-decoration: none;}
#navigation ul li a:hover,
#navigation ul li a.active { color:#00e0ff; }
如何将所选链接的样式更改为粗体和/或灰色?
最佳答案
means link click(while clicking the link it should be bold or grayed)
不需要为此涉及 jQuery。
:active
伪类将在元素被单击时选择元素(以及在元素获得焦点时按下 Enter)。
a:active { color: #333; }
关于jquery - 如何使用 jQuery 更改链接的样式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24076950/