当前页面状况 [英] Current page condition
问题描述
如果链接是当前页面的地址
,有没有办法改变导航栏中链接的颜色?
例如,如果我有:
首页 - index.php
产品 - products.php
联系方式 - contact.php
>
让我们说我在主页上,主页链接是深绿色而
产品和联系人是绿色的。
现在我转到产品页面,主页和联系人是绿色的,而
产品是深绿色。
到目前为止,我一直使用class =" current"属性为diferenciate,但
也许有一种更简单的CSS方式来实现它。你会怎么做?
谢谢,
-
Kerberos。
http://www.opera.com
http://www.freebsd.org
http://www.osresources.com
http://exodus.jabberstudio.org
Is there a way to change the color of a link in a navbar if the address of
the link is the current page?
For instance if I have:
Home - index.php
Products - products.php
Contact - contact.php
Let''s say I''m on the home page, and the Home link is dark green whereas
Products and Contact are green.
Now I go to the Products page and Home and Contact are green whereas
Products is dark green.
So far I have always used a class="current" attribute to diferenciate, but
maybe there is a more simple CSS way to do it. How would you do it?
Thanks,
--
Kerberos.
http://www.opera.com
http://www.freebsd.org
http://www.osresources.com
http://exodus.jabberstudio.org
推荐答案
Kerberos写道:
Kerberos wrote:
如果链接的地址是当前页面,有没有办法改变导航栏中链接的颜色?
Is there a way to change the color of a link in a navbar if the address of
the link is the current page?
不使用CSS。 JavaScript也许能够做到。通常最好的解决方案
是在服务器上生成菜单(或者在代码到达
服务器之前),并且该菜单条目根本不是链接(递归)链接是
不是一个好主意。)
-
David Dorward< http://blog.dorward。 me.uk/> < http://dorward.me.uk/>
首页是〜/ .bashrc的位置
Not with CSS. JavaScript might be able to do it. Generally the best solution
is to generate your menu on the server (or before the code reaches the
server) and have that menu entry not be a link at all (recursive links are
not a great idea).
--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
星期六,18 2004年12月20:26:32 -0200,Kerberos< me@privacy.net>写道:
On Sat, 18 Dec 2004 20:26:32 -0200, Kerberos <me@privacy.net> wrote:
如果链接的地址是当前页面,有没有办法改变导航栏中链接的颜色?
Is there a way to change the color of a link in a navbar if the address of
the link is the current page?
是的,重写您的页面,以便页面不会链接到自己。从来没有任何需要它是
,
史蒂夫
Yes, rewrite your page so that pages don''t link to themselves. There''s
never any need for it,
Steve
Steve Pugh< st *** @ pugh.net>写道:
Steve Pugh <st***@pugh.net> wrote:
2004年12月18日星期六20:26:32 -0200,Kerberos< me@privacy.net>写道:
On Sat, 18 Dec 2004 20:26:32 -0200, Kerberos <me@privacy.net> wrote:
如果链接的地址是当前页面,有没有办法改变导航栏中链接的颜色?
Is there a way to change the color of a link in a navbar if the address of
the link is the current page?
是的,重写您的页面,以便页面不会链接到自己。没有任何需要,
Yes, rewrite your page so that pages don''t link to themselves. There''s
never any need for it,
如果你喜欢共享一个模板,那就*需要它
在多个页面中,而不是必须在每个
页面上保持单独的,b $ b几乎但不完全相同的导航栏副本。
-
Harlan Messinger
从我的电子邮件地址中删除第一个点。
Veuillez?ter le premier point de mon adresse de courriel。
There *is* a need for it if you prefer to share a single template
among a number of pages instead of having to maintain separate,
nearly-but-not-quite-identical copies of your navigation bar on every
page.
--
Harlan Messinger
Remove the first dot from my e-mail address.
Veuillez ?ter le premier point de mon adresse de courriel.
这篇关于当前页面状况的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!