473,466 Members | 1,465 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Problem with visited links

Hey.

I'm experiencing a problem using a css stylesheet on my homepage
(http://w1.193.telia.com/~u19305515/test/testis.html). As you can see, the
link works according to the stylesheet when not visited. But when the link
is visited, the stylesheet has no effect on the link. Basically, what my
problem is all about, is that I want my visited links to be underlined in
hover, just like they are when not visited.

I hope there is someone who can help me with this issue!
/Rickard

This is how my .css file looks like now:

A:active {
COLOR: #4040cc; FONT-FAMILY: Tahoma; FONT-SIZE: 9pt; TEXT-DECORATION:
underline
}
A:hover {
COLOR: #aa0050; FONT-FAMILY: Tahoma; FONT-SIZE: 9pt; TEXT-DECORATION:
underline
}
A:link {
COLOR: #4040cc; FONT-FAMILY: Tahoma; FONT-SIZE: 9pt; TEXT-DECORATION: none
}
A:visited {
COLOR: #4040cc; FONT-FAMILY: Tahoma; FONT-SIZE: 9pt; TEXT-DECORATION: none
}
BODY {
COLOR: #000000; FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 8pt;
}

#PCL {
font-family: Verdana,Arial,Helvetica;
font-style: none;
font-weight: normal;
text-decoration: none;
font-size: 8pt;
}

#PTT {
font-family: Verdana,Arial,Helvetica;
font-size: 8pt;
}

#PST {
font-family: Verdana,Arial,Helvetica;
font-size: 8pt;
}

Jul 20 '05 #1
17 3836
"Rickard Lindhé" <ri***********@telia.com> wrote:
I'm experiencing a problem using a css stylesheet on my homepage
(http://w1.193.telia.com/~u19305515/test/testis.html). As you can see, the
link works according to the stylesheet when not visited. But when the link
is visited, the stylesheet has no effect on the link. Basically, what my
problem is all about, is that I want my visited links to be underlined in
hover, just like they are when not visited.
This is how my .css file looks like now:

A:active {
COLOR: #4040cc; FONT-FAMILY: Tahoma; FONT-SIZE: 9pt; TEXT-DECORATION:
underline
}
A:hover {
COLOR: #aa0050; FONT-FAMILY: Tahoma; FONT-SIZE: 9pt; TEXT-DECORATION:
underline
}
A:link {
COLOR: #4040cc; FONT-FAMILY: Tahoma; FONT-SIZE: 9pt; TEXT-DECORATION: none
}
A:visited {
COLOR: #4040cc; FONT-FAMILY: Tahoma; FONT-SIZE: 9pt; TEXT-DECORATION: none
}


The last style defined takes precedence when more than one style of
equal specificity applies. When a link is both visited and hovered the
last defined style will be used, which in your case is :visited.

The preferred order is :link :visited :hover :active

BTW, points are print media units and really aren't much good for use
in screen stylesheets. Google for the many threads explaining why.

Steve
--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 20 '05 #2
On Tue, 17 Feb 2004 23:21:35 GMT, Rickard Lindhé <ri***********@telia.com>
wrote:
A:active {
COLOR: #4040cc; FONT-FAMILY: Tahoma; FONT-SIZE: 9pt; TEXT-DECORATION:
underline
}
A:hover {
COLOR: #aa0050; FONT-FAMILY: Tahoma; FONT-SIZE: 9pt; TEXT-DECORATION:
underline
}
A:link {
COLOR: #4040cc; FONT-FAMILY: Tahoma; FONT-SIZE: 9pt; TEXT-DECORATION:
none
}
A:visited {
COLOR: #4040cc; FONT-FAMILY: Tahoma; FONT-SIZE: 9pt; TEXT-DECORATION:
none
}


In addition to Steve's points, I'm wondering whether it's wise to
eliminate the underlining on these links. Sure, you dd it when someone
hovers, but how do you know it's there to hover over it? Seems to me these
links will be followed through dumb luck.

Perhaps your context makes it absolutely and unambiguously clear where the
links are without underlining, in which case never mind.
Jul 20 '05 #3
Quoth the raven named Rickard Lindhé:
Hey.

I'm experiencing a problem using a css stylesheet on my homepage
(http://w1.193.telia.com/~u19305515/test/testis.html). As you can see, the
link works according to the stylesheet when not visited. But when the link
is visited, the stylesheet has no effect on the link. Basically, what my
problem is all about, is that I want my visited links to be underlined in
hover, just like they are when not visited.

I hope there is someone who can help me with this issue!
/Rickard

This is how my .css file looks like now:

A:active {
COLOR: #4040cc; FONT-FAMILY: Tahoma; FONT-SIZE: 9pt; TEXT-DECORATION:
underline
}
A:hover {
COLOR: #aa0050; FONT-FAMILY: Tahoma; FONT-SIZE: 9pt; TEXT-DECORATION:
underline
}
A:link {
COLOR: #4040cc; FONT-FAMILY: Tahoma; FONT-SIZE: 9pt; TEXT-DECORATION: none
}
A:visited {
COLOR: #4040cc; FONT-FAMILY: Tahoma; FONT-SIZE: 9pt; TEXT-DECORATION: none
}
Your sequence is wrong. It needs to be link, visited, hover, active.
"Las Vegas Has Animals."

BODY {
COLOR: #000000; FONT-FAMILY: Verdana, Arial, Helvetica; FONT-SIZE: 8pt;
}

#PCL {
font-family: Verdana,Arial,Helvetica;
font-style: none;
font-weight: normal;
text-decoration: none;
font-size: 8pt;
}

#PTT {
font-family: Verdana,Arial,Helvetica;
font-size: 8pt;
}

#PST {
font-family: Verdana,Arial,Helvetica;
font-size: 8pt;
}


Please read any of the other dozens of threads that tell you Verdana
is a Bad Idea™ and to assign font-size: 100%
http://www.xs4all.nl/~sbpoley/webmatters/verdana.html

Oh, you do not need to repeat the font-family in every style. Just
place it once in the body {}. The C of CSS is Cascading.

--
-bts
-This space intentionally left blank.
Jul 20 '05 #4
It seems "Steve Pugh" wrote in
comp.infosystems.www.authoring.stylesheets:
The preferred order is :link :visited :hover :active


After which I put a[name] because some browsers (sorry, don't
remember which) styles <a name="...">...</a> the same as links, and
that cured it.

Seems strange that a browser smart enough to recognize an attribute
selector would be dumb enough to think that <a name> is a link, but
it happened.

--
Stan Brown, Oak Road Systems, Cortland County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2 spec: http://www.w3.org/TR/REC-CSS2/
2.1 changes: http://www.w3.org/TR/CSS21/changes.html
validator: http://jigsaw.w3.org/css-validator/
Jul 20 '05 #5
Stan Brown <th************@fastmail.fm> wrote:
The preferred order is :link :visited :hover :active
After which I put a[name] because some browsers (sorry, don't
remember which) styles <a name="...">...</a> the same as links, and
that cured it.


Mozilla?
Seems strange that a browser smart enough to recognize an attribute
selector would be dumb enough to think that <a name> is a link, but
it happened.


Actually, if you use the selector :hover as such, or the selector
a:hover, then I'd say there's nothing foolish in making it match any
<a> element when hovered. Whether an <a> without href can be in the
pseudo-class :active is more questionable, but there's nothing in the
specs that prevents it.

So the safe approach is
:link { ... }
:visited { ... }
:link:hover, :visited:hover { ... }
:link:active, :visited:active { ... }

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Jul 20 '05 #6
Stan Brown wrote:
After which I put a[name] because some browsers (sorry, don't
remember which) styles <a name="...">...</a> the same as links, and
that cured it.

Seems strange that a browser smart enough to recognize an attribute
selector would be dumb enough to think that <a name> is a link, but
it happened.


Such browsers don't think that <a name> is a link, and don't apply styles
using the a:link or a:visited selectors. They do apply the a:hover selector
because this says "An anchor that has the mouse over it" not "A link that
has the mouse over it".

--
David Dorward <http://dorward.me.uk/>
Jul 20 '05 #7
"Rickard Lindhé" <ri***********@telia.com> wrote in message news:<3m********************@newsb.telia.net>...
[snip]
A:visited {
COLOR: #4040cc; FONT-FAMILY: Tahoma; FONT-SIZE: 9pt; TEXT-DECORATION: none
}


With a few exceptions, it's generally a bad idea to remove the
underline from links (even visited ones). See the second half ('Why
not to do it') of:

http://www.safalra.com/hypertext/htm...linelinks.html

--- Safalra (Stephen Morley) ---
http://www.safalra.com/hyerptext
Jul 20 '05 #8
On Wed, 18 Feb 2004 19:45:19 -0500, Stan Brown
<th************@fastmail.fm> wrote:
It seems "Steve Pugh" wrote in
comp.infosystems.www.authoring.stylesheets:
The preferred order is :link :visited :hover :active


After which I put a[name] because some browsers (sorry, don't
remember which) styles <a name="...">...</a> the same as links, and
that cured it.


That would be Mozilla, as Jukka surmised. But you can also "cure" that
problem by keeping the attribute empty; e.g.:

<h2><a name="foo"></a>Bar</h2>

I've read several times that some (older?) browsers have trouble with
keeping the attribute empty, but it seems to work for me in every
browser I've tried, even NS4.

Nick

--
Nick Theodorakis
ni**************@hotmail.com
nicholas_theodorakis [at] urmc [dot] rochester [dot] edu
Jul 20 '05 #9
ni**************@hotmail.com (Nick Theodorakis) wrote:
<h2><a name="foo"></a>Bar</h2>

I've read several times that some (older?) browsers have trouble with
keeping the attribute empty, but it seems to work for me in every
browser I've tried, even NS4.


But this trick is not needed if you use suitable selectors, as
mentioned - and it is instructive to learn to use selectors properly.

Empty <a> elements used to confuse some rather early browsers (could
have been IE 2 or something), and much later some problems with quite
different browsers emerged. Instead of trying to trace back the history
and study the present and guess the future, I would just use the safe
and logical way.

Some people say that the logical way is to use just the id attribute,
and W3C policy says the same. And <h2 id="foo">Bar</h2> works fine on
most browsers, and avoids the problem discussed here. But
<h2><a name="foo">Bar</a></h2> is still somewhat safer.

There's a CSS-related reason to avoid empty <a> elements. Suppose an
author wishes to study a page (written by someone else, or maybe by
himself a year ago) to see the possible target anchors, in order to
know what locations inside the page can be "jumped into". Reading the
source code is one option, but it is more comfortable to authors who
use an advanced browser to set up a user style sheet that hightlights
a) all elements with id attributes
b) all a elements with name attributes
and what happens in b) when the element is empty?

(OK, this argument cheats a little. An advanced browser supports
:before and :after pseudoelements, too.)

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Jul 20 '05 #10
On Fri, 20 Feb 2004 07:16:03 +0000 (UTC), "Jukka K. Korpela"
<jk******@cs.tut.fi> wrote:

[...]
Some people say that the logical way is to use just the id attribute,
and W3C policy says the same. And <h2 id="foo">Bar</h2> works fine on
most browsers, and avoids the problem discussed here.

I have started doing this on my personal site. I decided that the
number of NS4 users hitting my site is low enough that those still
using it have made a deliberate choice to do so and are aware of its
limitations.

Nick

--
Nick Theodorakis
ni**************@hotmail.com
nicholas_theodorakis [at] urmc [dot] rochester [dot] edu
Jul 20 '05 #11
It seems "Nick Theodorakis" wrote in
comp.infosystems.www.authoring.stylesheets:
On Fri, 20 Feb 2004 07:16:03 +0000 (UTC), "Jukka K. Korpela"
<jk******@cs.tut.fi> wrote:
Some people say that the logical way is to use just the id attribute,
and W3C policy says the same. And <h2 id="foo">Bar</h2> works fine on
most browsers, and avoids the problem discussed here.


I have started doing this on my personal site. I decided that the
number of NS4 users hitting my site is low enough that those still
using it have made a deliberate choice to do so and are aware of its
limitations.


I have been thinking seriously about making this switch too, but I
don't know if I'm quite ready. On the hand, we're talking about only
1.1% of browsers having navigation fail[1]; on the other hand, 1% of
some hundreds of millions is a frightening number.

[1] <http://www.useit.com/alertbox/990418.html> and scroll down to
"Update 2003"

Anyone have more up-to-date and equally believable figures?

--
Stan Brown, Oak Road Systems, Cortland County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2 spec: http://www.w3.org/TR/REC-CSS2/
2.1 changes: http://www.w3.org/TR/CSS21/changes.html
validator: http://jigsaw.w3.org/css-validator/
Jul 20 '05 #12


Stan Brown wrote:
It seems "Nick Theodorakis" wrote in
comp.infosystems.www.authoring.stylesheets:
On Fri, 20 Feb 2004 07:16:03 +0000 (UTC), "Jukka K. Korpela"
<jk******@cs.tut.fi> wrote:
Some people say that the logical way is to use just the id attribute,
and W3C policy says the same. And <h2 id="foo">Bar</h2> works fine on
most browsers, and avoids the problem discussed here.


I have started doing this on my personal site. I decided that the
number of NS4 users hitting my site is low enough that those still
using it have made a deliberate choice to do so and are aware of its
limitations.

I have been thinking seriously about making this switch too, but I
don't know if I'm quite ready. On the hand, we're talking about only
1.1% of browsers having navigation fail[1]; on the other hand, 1% of
some hundreds of millions is a frightening number.


On the other hand, you may estimate how many of those "1% of some
hundreds of millions" is visiting your site? :-)

--
/Arne
Jul 20 '05 #13
On Sat, 21 Feb 2004 09:43:04 -0500, Stan Brown
<th************@fastmail.fm> wrote:
It seems "Nick Theodorakis" wrote in
comp.infosystems.www.authoring.stylesheets:
On Fri, 20 Feb 2004 07:16:03 +0000 (UTC), "Jukka K. Korpela"
<jk******@cs.tut.fi> wrote:
Some people say that the logical way is to use just the id attribute,
and W3C policy says the same. And <h2 id="foo">Bar</h2> works fine on
most browsers, and avoids the problem discussed here.


I have started doing this on my personal site. I decided that the
number of NS4 users hitting my site is low enough that those still
using it have made a deliberate choice to do so and are aware of its
limitations.


I have been thinking seriously about making this switch too, but I
don't know if I'm quite ready. On the hand, we're talking about only
1.1% of browsers having navigation fail[1]; on the other hand, 1% of
some hundreds of millions is a frightening number.

[1] <http://www.useit.com/alertbox/990418.html> and scroll down to
"Update 2003"

Anyone have more up-to-date and equally believable figures?


Well, I was talking about my own logs, so the numbers are believable
to me insofar as how accurately browsers identify themselves. FWIW, in
February, my logs show that about 0.2% of non-spider user-agents call
themselves Netscape 4.something.

In any case, I was just using those links as a "table of contents" to
lead users farther down the page, if they choose to do so, so it's not
a fatal error if they can't use it.

Nick

--
Nick Theodorakis
ni**************@hotmail.com
nicholas_theodorakis [at] urmc [dot] rochester [dot] edu
Jul 20 '05 #14
On Sat, 21 Feb 2004 09:43:04 -0500, Stan Brown
<th************@fastmail.fm> wrote:
It seems "Nick Theodorakis" wrote in
comp.infosystems.www.authoring.stylesheets:
On Fri, 20 Feb 2004 07:16:03 +0000 (UTC), "Jukka K. Korpela"
<jk******@cs.tut.fi> wrote:
Some people say that the logical way is to use just the id attribute,
and W3C policy says the same. And <h2 id="foo">Bar</h2> works fine on
most browsers, and avoids the problem discussed here.


I have started doing this on my personal site. I decided that the
number of NS4 users hitting my site is low enough that those still
using it have made a deliberate choice to do so and are aware of its
limitations.


I have been thinking seriously about making this switch too, but I
don't know if I'm quite ready. On the hand, we're talking about only
1.1% of browsers having navigation fail[1]; on the other hand, 1% of
some hundreds of millions is a frightening number.

[1] <http://www.useit.com/alertbox/990418.html> and scroll down to
"Update 2003"

Anyone have more up-to-date and equally believable figures?

Just under 2% of my visitors (this month) have a browser which ignores
'@import' - presumably most of them are NN4 users.

--
Stephen Poley

http://www.xs4all.nl/~sbpoley/webmatters/
Jul 20 '05 #15
It seems "Nick Theodorakis" wrote in
comp.infosystems.www.authoring.stylesheets:
On Sat, 21 Feb 2004 09:43:04 -0500, Stan Brown
<th************@fastmail.fm> wrote:
It seems "Nick Theodorakis" wrote in
comp.infosystems.www.authoring.stylesheets: [use id= instead of separate <a name= ]
[1] <http://www.useit.com/alertbox/990418.html> and scroll down to
"Update 2003" [says 1.1% Netscape 4.x as of a year ago]
Anyone have more up-to-date and equally believable figures?
Well, I was talking about my own logs, so the numbers are believable
to me insofar as how accurately browsers identify themselves. FWIW, in
February, my logs show that about 0.2% of non-spider user-agents call
themselves Netscape 4.something.
Interesting. Though you might have a different mix of users, that
seems like only the "lunatic fringe" are using Netscape 4. :-)
In any case, I was just using those links as a "table of contents" to
lead users farther down the page, if they choose to do so, so it's not
a fatal error if they can't use it.


Hmm -- matter of taste and opinion. When I as a visitor click on a
link and nothing happens, I assume the site is badly written. I'm
not using Netscape 4, though.

--
Stan Brown, Oak Road Systems, Cortland County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2 spec: http://www.w3.org/TR/REC-CSS2/
2.1 changes: http://www.w3.org/TR/CSS21/changes.html
validator: http://jigsaw.w3.org/css-validator/
Jul 20 '05 #16
It seems "Stephen Poley" wrote in
comp.infosystems.www.authoring.stylesheets:
Just under 2% of my visitors (this month) have a browser which ignores
'@import' - presumably most of them are NN4 users.


Oh dear. That goes the other way from Nick's experience.

This would make a good case study for my statistics class: is the
proportion of Netscape 4.x users 2%, 0.2%, or what? Then we'll get
to talk about non-random samples and measurement error.

--
Stan Brown, Oak Road Systems, Cortland County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2 spec: http://www.w3.org/TR/REC-CSS2/
2.1 changes: http://www.w3.org/TR/CSS21/changes.html
validator: http://jigsaw.w3.org/css-validator/
Jul 20 '05 #17
Stan Brown wrote:

[use id= instead of separate <a name= ]

[Netscape 4.x]

When I as a visitor click on a link and nothing happens, I assume the
site is badly written. I'm not using Netscape 4, though.


That is a big difference, I think. Consider how many sites are badly
authored, and think about how they might render in Netscape 4. I'd
imagine that N4 users must be used to things breaking on a regular basis.

--
Brian (remove "invalid" in my address to email me)
http://www.tsmchughs.com/
Jul 20 '05 #18

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
by: Jan Tuxen | last post by:
Jakob Nielsen in his most recent Alertbox (http://www.useit.com/alertbox/20040503.html) tells web authors to change the color of visited links. I agree to his purpose: Help users understand...
6
by: - jes | last post by:
Greetings. Using CSS, a programmer can set the color for an href link and a different color for a VISITED href link. Anyone know where this "list" of visited links is stored? Is it...
1
by: Chad | last post by:
First visit all of the links on the page. For each, if the link opens a new window, close it. If it opnes in teh same window, hit back. then hit REFRESH. Notice that while all links SHOULd be...
2
by: george.leithead | last post by:
Hi all, I have a very strange problem! In following Web page (which is generated from a CMS System), the navigation to the left 'dissapears' when you roll the mouse over the links? It does not...
0
by: PsyBorg | last post by:
This is not entirely a PHP question although it is based in PHP. I have been creating a site, where I want the visitors to see the visited links as "Crossed Out" using CSS. However, I also want...
8
by: Jeff | last post by:
ASP.NET 2.0 I'm wondering how to set the color of a visited HyperLinkField (the link text) in a GridView?? Here is the markup of the HyperLinkField I have problems with: <asp:HyperLinkField...
27
by: Corey Walker | last post by:
Hello: I developed a nice looking web page which provided people with a brief overview of our society's publications (our different newsletters). However, while I'm by no means an expert or...
1
beacon
by: beacon | last post by:
I'm looking to reset the visited link color once another link is selected. Also, once that link takes me to a particular page, I want the font-weight for that page to be bold to indicate that it's...
3
by: Steve | last post by:
Hi All I have an asp.net 2.0 website with the following css file It uses Master pages and in Firefox 3.04 for windows only, 3 of the web pages don't display the Master page properly The...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.