472,119 Members | 1,483 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,119 software developers and data experts.

menu link to not change color

Hello. I have a navigation bar at the top of all my pages with css-styled
buttons that change color when hovered over. I am a little confused on how
to disable that for the link that the page is on, for example, the sitemap
link in the navigation bar on the sitemap page, the studies link for the
navigation bar on the studies page, etc.

The css is at http://www.TheBicyclingGuitarist.net/css/style.css

The sitemap is at
http://www.TheBicyclingGuitarist.net/sitemap.htm

Any tips will be greatly appreciated. Do I need to make a new class and
surround the relevant link with <spantags, or is there a better way?
Thanks.

--
The Bicycling Guitarist
Jan 14 '08 #1
10 3849

"dorayme" <do************@optusnet.com.auwrote in message
news:do**********************************@news-vip.optusnet.com.au...
In article <47**********************@read.cnntp.org>,
"The Bicycling Guitarist" <Ch***@TheBicyclingGuitarist.net>
wrote:
>Hello. I have a navigation bar at the top of all my pages with css-styled
buttons that change color when hovered over. I am a little confused on
how
First, yes, you can just class the link you do not want to have
hovering effects; <a class="current" href="...is a common
practice. You then style the .current how you wish in the css.
Second, you can also not have the link at all so not even a
cursor hand will appear, in this case you might style just the li
itself to fit in with the real links in style. It is common and
informational to have the text a little different, perhaps in
colour or background (this is an extra way for users to know
which page they are on out of the choices in the navigation strip.

Third, (but I have not studied your site properly so this may not
be convenient on the whole) you don't generally need to keep
putting class="menu2" if you use #menubar li a to specify a
style. It is briefer.
Thank you for your help, Dorayme.
Well I followed the first suggestion so far, but I plan to implement the
second suggestion (no link, just styling the li for the current page), and I
want to learn how to do the third suggestion. It's a little beyond me right
now. I automatically think "tic-tac-toe" when I see #.
Jan 14 '08 #2

"The Bicycling Guitarist" <Ch***@TheBicyclingGuitarist.netwrote in message
news:47**********************@read.cnntp.org...
Hello. I have a navigation bar at the top of all my pages with css-styled
buttons that change color when hovered over. I am a little confused on how
to disable that for the link that the page is on, for example, the sitemap
link in the navigation bar on the sitemap page, the studies link for the
Oh heck. I just noticed that the navigation bar for the site map page is a
wee bit smaller than the navigation bars on all the other pages. I think
this is because I have set styles for <pand <ain the header of the site
map page so they are only 90% regular size (because of all the links on that
page). What's the best fix for this without changing the 90% for the body
content? I don't want to assign a class name and put that into every single
<pand <aon the page.
Jan 14 '08 #3
In article <47**********************@read.cnntp.org>,
"The Bicycling Guitarist" <Ch***@TheBicyclingGuitarist.net>
wrote:
"dorayme" <do************@optusnet.com.auwrote in message
news:do**********************************@news-vip.optusnet.com.au...
In article <47**********************@read.cnntp.org>,
"The Bicycling Guitarist" <Ch***@TheBicyclingGuitarist.net>
wrote:
Third, (but I have not studied your site properly so this may not
be convenient on the whole) you don't generally need to keep
putting class="menu2" if you use #menubar li a to specify a
style. It is briefer.

Thank you for your help, Dorayme.
Well I followed the first suggestion so far, but I plan to implement the
second suggestion (no link, just styling the li for the current page), and I
want to learn how to do the third suggestion. It's a little beyond me right
now. I automatically think "tic-tac-toe" when I see #.
OK, about the third, here is a sort of case where the savings are
considerable - might get you to see how easy it is:

Suppose you want to float a *lot* of divs, you want them to be a
certain size as well and maybe other special things. Let us
suppose they are in a wrapper div.

<dv id="wrapper">...lots of divs within...</div>.

It is a bore (as well as adding to bandwidth and clutter) to
class every single inner div. It is easier to target them all in
one go by:

#wrapper div {float: left; width: ... etc ...;}

This targets all the div children of the #wrapper div. Not any
other divs elsewhere. You can also use classed wrappers. ID here
is just an example (to emphasise that it is unique and therefore
a rather nice handle to identify a whole mob of its children).

From what I did see of your css, I am sure you do understand this
idea to a degree (see your own css!).

--
dorayme
Jan 14 '08 #4

"The Bicycling Guitarist" <Ch***@TheBicyclingGuitarist.netwrote in message
news:47**********************@read.cnntp.org...
>
"The Bicycling Guitarist" <Ch***@TheBicyclingGuitarist.netwrote in
message news:47**********************@read.cnntp.org...
>Hello. I have a navigation bar at the top of all my

Oh heck. I just noticed that the navigation bar for the site map page is a
wee bit smaller than the navigation bars on all the other pages. I think
this is because I have set styles for <pand <ain the header of the
site map page so they are only 90% regular size (because of all the links
on that page). What's the best fix for this without changing the 90% for
the body content?
For now, I removed the 90% from the css in the header. I could add it back
for the div containing the sitemap content, or not. I thought that with so
many links, that having slightly smaller text would be more useful.
Jan 14 '08 #5
On 14 Jan, 06:35, dorayme <doraymeRidT...@optusnet.com.auwrote:
There are some server side solutions so the page itself "knows"
which page it is and "turns off" links to itself. In PHP.
You can do that statically too.

Put a "pagename" class onto the body for each page.

Use slightly more complex CSS selectors (including a hard-coded list
of pagenames) to recognise each of these.
The cost of this is needing to hard-code that list into the CSS, but
it works, and it works with static code.
Jan 14 '08 #6
In article
<c2**********************************@k2g2000hse.g ooglegroups.com
>,
Andy Dingley <di*****@codesmiths.comwrote:
On 14 Jan, 06:35, dorayme <doraymeRidT...@optusnet.com.auwrote:
There are some server side solutions so the page itself "knows"
which page it is and "turns off" links to itself. In PHP.

You can do that statically too.

Put a "pagename" class onto the body for each page.

Use slightly more complex CSS selectors (including a hard-coded list
of pagenames) to recognise each of these.
The cost of this is needing to hard-code that list into the CSS, but
it works, and it works with static code.
Actually, thanks for the reminder on this. I speak, of course, on
behalf of the archives. <g>

--
dorayme
Jan 14 '08 #7

"dorayme" <do************@optusnet.com.auwrote in message
news:do**********************************@news-vip.optusnet.com.au...
In article <47**********************@read.cnntp.org>,
"The Bicycling Guitarist" <Ch***@TheBicyclingGuitarist.net>
wrote:
>"dorayme" <do************@optusnet.com.auwrote in message
news:do**********************************@news-vip.optusnet.com.au...
In article <47**********************@read.cnntp.org>,
"The Bicycling Guitarist" <Ch***@TheBicyclingGuitarist.net>
wrote:
Third, (but I have not studied your site properly so this may not
be convenient on the whole) you don't generally need to keep
putting class="menu2" if you use #menubar li a to specify a
style. It is briefer.
>now. I automatically think "tic-tac-toe" when I see #.

OK, about the third, here is a sort of case where the savings are
considerable - might get you to see how easy it is:
<snip>
<dv id="wrapper">...lots of divs within...</div>.

It is a bore (as well as adding to bandwidth and clutter) to
class every single inner div. It is easier to target them all in
one go by:

#wrapper div {float: left; width: ... etc ...;}

This targets all the div children of the #wrapper div. Not any
other divs elsewhere. You can also use classed wrappers. ID here
is just an example (to emphasise that it is unique and therefore
a rather nice handle to identify a whole mob of its children).

From what I did see of your css, I am sure you do understand this
idea to a degree (see your own css!).
I understand it to a degree, but based on the online tutorials I've found
for css I'd rate myself at the low intermediate level, above beginner but
far below advanced. This newsgroup and the c.i.w.a.h. newsgroup have helped
me a lot over the years. What you have suggested with this tip is the next
great project for me to improve the code of my web site. It may take a while
yet.
Jan 15 '08 #8
Art
On 1/14/08 7:16 AM, Andy Dingley wrote:
On 14 Jan, 06:35, dorayme <doraymeRidT...@optusnet.com.auwrote:
>There are some server side solutions so the page itself "knows"
which page it is and "turns off" links to itself. In PHP.

You can do that statically too.

Put a "pagename" class onto the body for each page.

Use slightly more complex CSS selectors (including a hard-coded list
of pagenames) to recognise each of these.
The cost of this is needing to hard-code that list into the CSS, but
it works, and it works with static code.
Andy,
Do you have a code snippet or live example of this static method that
you could share ?

TIA.

--
Art
Jan 15 '08 #9
On 16 Jan, 01:51, dorayme <doraymeRidT...@optusnet.com.auwrote:
Hey, Andy! I notice the archive references are so easy to find
that you find it quicker to bang up examples on a keyboard.
I don't. I pasted that from an article in my own local archives - the
subject line was "Navigation", if you want to look for it.
Jan 16 '08 #10
Art
On 1/15/08 7:50 PM, Andy Dingley wrote:
On Tue, 15 Jan 2008 23:13:54 GMT, Art <me@nowhere.comwrote:
>>Do you have a code snippet or live example of this static method that
you could share ?

Of course - I keep it carefully filed in Google's archive of this
newsgroup. If you search, you might even find it, there are several
copies.

Otherwise try this for starters:
[...]
Thanks, Andy. A very innovative use of css.

--
Art
Jan 16 '08 #11

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Richard | last post: by
4 posts views Thread by paula | last post: by
4 posts views Thread by N00b13 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.