突出显示活动标签 - CSS [英] Highlighting an active tab - CSS

查看:254
本文介绍了突出显示活动标签 - CSS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个小标签式导航设置使用CSS。当悬停在标签上的颜色变化,伟大。但是,当我点击某个标签并导航到相应的页面时,我希望该标签(活动标签?)保持高亮显示,表示当前页面。

I have a small tabbed navigation setup using CSS. When hovering over the tabs the colour changes, great. However when i click a tab and it navigates to the corresponding page, i would like that tab (the active tab?) to remain highlighted, indicating the current page.

我目前这样做通过使用类(.currenttab),然后在每个HTML文件中使用此类。我不使用:

I am currently doing this by using a class (.currenttab ) and then using this class in each HTML file. I am not using:

active

有没有方法让我使用活动,而不是在每个单独的HTML文件中使用一个类,或者我正在做什么正确?

Is there a way for me to use active, rather than using a class in each individual HTML file, or is what i am doing correct?

提前谢谢。

推荐答案

您所做的是正确的。 :active 伪选择器表示其他内容 -

What you are doing is correct. The :active pseudo selector means something else - the event of activating a control (ie, the time between a user presses the mouse button and releases it).

使用类来表示所选择的项目是要走的方式(例如,用户按下鼠标按钮并释放它的时间)。 。

Using a class to signify the selected item is the way to go.

这篇关于突出显示活动标签 - CSS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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