467,169 Members | 959 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,169 developers. It's quick & easy.

Retain Active Link color on selected page


I'm having trouble with my CSS. My links are black, my hover is orange
and my active link is red. When I select a link it turns red but i
does not retain that color when the selected page loads. Is i
possible to retain that color?

My navigation that i'm trying to get this corrected on is
server-side
include
-
crhayne
-----------------------------------------------------------------------
Posted via http://www.forum4designers.co
-----------------------------------------------------------------------
View this thread: http://www.forum4designers.com/message112989.htm

Jul 20 '05 #1
  • viewed: 19844
Share:
4 Replies
crhaynes wrote:
I'm having trouble with my CSS. My links are black, my hover is orange,
and my active link is red. When I select a link it turns red but it
does not retain that color when the selected page loads.
Of course not, when you go to the other page the link is no longer being
activated (clicked on, or key pressed while focused).
Is it possible to retain that color?
Not without altering the markup of the page (e.g. class selectors).
------------------------------------------------------------------------
Posted via http://www.forumXdesigners.com
------------------------------------------------------------------------
View this thread: http://www.forumXdesigners.com/message112989.html


Please get a real newsreader.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jul 20 '05 #2
In article <cr*************@mail.forum4designers.com>,
crhaynes <cr*************@mail.forum4designers.com> wrote:

I'm having trouble with my CSS. My links are black,
I hope your normal text isn't black, then. Some of us weirdos turn
off underlining links. (I prefer hover, myself.)
my hover is orange,
and my active link is red. When I select a link it turns red but it
does not retain that color when the selected page loads. Is it
possible to retain that color?
As the other reply said, no. However, you didn't mention setting your
visited link color to anything. Is that what you're asking about?
You use a:visited for that. For the colors to display properly, they
must be in this order in your stylesheet:

a:link
a:visited
a:hover
a:active
My navigation that i'm trying to get this corrected on is a
server-side include.


That should be irrelevnt.

--
lkseitz (Lee K. Seitz) .at. hiwaay @dot@ net
"I'm down with Bill Gates, I call him Money for short
I phone him up at home and I make him do my tech support"
-- "Weird Al" Yankovic, "It's All About The Pentiums"
Jul 20 '05 #3
crhaynes wrote:
I'm having trouble with my CSS. My links are black, my hover is orange,
and my active link is red. When I select a link it turns red but it
does not retain that color when the selected page loads. Is it
possible to retain that color?

I'm not sure to understand what you mean, but you might want to set your
visited links as red too: a:visited { color: red ; } (fine-tune this
rule according to your needs).
--
Want to spend holidays in France ? Check http://www.relinquiere.com/
Jul 20 '05 #4

"crhaynes" <cr*************@mail.forum4designers.com> wrote in message
news:cr*************@mail.forum4designers.com...

I'm having trouble with my CSS. My links are black, my hover is orange,
and my active link is red. When I select a link it turns red but it
does not retain that color when the selected page loads. Is it
possible to retain that color?


If the old page has been replaced by a new page, how is it that the link you
clicked is even showing?

If you mean that the new page has the same links on it as the old page, then
the answer is that when a page loads, the active element on it isn't an
element that happens to look like the element that you clicked on the
previous page. The active element on the new page, if there is one, will be
the same as it would be if you had gone to that page directly.

Maybe what you're trying to do is to get the link--probably on a navigation
bar--that corresponds to the *current* page to have a different appearance
from the other links on the nav bar, *regardless* of how you got to that
page. That's a different question from the one you asked. You can accomplish
that with a stylesheet with code like the following:

#navlinks a { /* regular nav bar link properties */ }
#pageA #linkA,
#pageB #linkB,
#pageC #linkC,
#pageD #linkD { /* properties of the link to the current page */ }

and HTML like this:

<body id="pageC">
...
<div id="navlinks">
...<a id="linkA">...</a>...
...<a id="linkB">...</a>...
...<a id="linkC">...</a>...
...<a id="linkD">...</a>...
</div>
...

On page A, the body would have id="pageA", etc. Link "linkA" points to page
A, etc. The DIV with id="navlinks" contains the entire nav bar.

Jul 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Carla | last post: by
3 posts views Thread by Penny Bond | last post: by
3 posts views Thread by ANTISPAM_garycnew_ANTISPAM@yahoo.com | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.