最简单的类“当前页面” nav元素? [英] Easiest way to class "current page" nav element?

查看:140
本文介绍了最简单的类“当前页面” nav元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的网页上有一个导航栏,链接到不同的网页。是否有一种简单的方法来自动设置与当前页面对应的导航元素上的类?例如,如果您正在查看关于我们页面,我希望栏上的关于我们标签有不同的样式。我知道我可以为每个页面增加一些PHP,但我宁愿有一个更一般的设置和忘记解决方案。

I have a navigation bar on my webpage with links to different pages. Is there an easy way to automatically set the class on the navigation element corresponding to the current page? For instance, I want the "About Us" tab on the bar to have a different style if you're currently viewing the "About Us" page. I know I could rig up some PHP for each page, but I'd rather have a more general set-it-and-forget-it solution.

推荐答案

我以前使用过,效果很好。

i've used this before and it works well.

http://www.cssnewbie.com/intelligent-navigation/

这篇关于最简单的类“当前页面” nav元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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