简体   繁体   English

如何为单独的链接类分配单独的伪链接状态?

[英]How to assign separate pseudo link states for separate classes of links?

I have a download button and a simple link. 我有一个下载按钮和一个简单的链接。 I styled the download button with the needed pseudo classes like this: 我使用所需的伪类为下载按钮设置了样式,如下所示:

a:active , a:hover , and a:focus a:activea:hovera:focus

Now what for other class of links? 现在,其他类别的链接又如何呢?

Will a:active .newclass do? a:active .newclass做吗? It doesn't. 没有。

Change your CSS selector with this one 更改您的CSS选择器

a.newclass:active

Otherwise you will looking for elements with the .newClass class INSIDE your a tags 否则,你将寻找与元素.newClassa标签

You have to use the right CSS selector. 您必须使用正确的CSS选择器。

For a pseudoclass :active of a link of class .newclass you should use: 对于类.newclass的链接的伪类:active ,应使用:

a.newclass:active

This will affect any link looking like this: 这将影响任何看起来像这样的链接:

<a href='#' class='newclass'></a>

For a link with class .inner within an active link of class .outer you should use: 对于类.inner的活动链接中的类.outer链接,应使用:

a.outer:active .inner

This will affect any link looking like this: 这将影响任何看起来像这样的链接:

<a href='#' class='outer'>
  <a href='#' class='inner'></a>
</a>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM