Google Answers Logo
View Question
 
Q: Problem with CSS Style Sheets ( Answered 4 out of 5 stars,   4 Comments )
Question  
Subject: Problem with CSS Style Sheets
Category: Computers > Programming
Asked by: mbriney-ga
List Price: $20.00
Posted: 25 Jun 2003 09:58 PDT
Expires: 25 Jul 2003 09:58 PDT
Question ID: 221592
I'm having problems with cascading style sheets.

When you goto http://www.teladesign.net/newtcs/ all of the styles
appear the way they should, all of the hover colors are correct as
well.

But when you click on a link and then go back to the homepage all of
the styles are incorrect.

The style sheet can be found here:
http://www.teladesign.net/newtcs/tcs-stylesheet.css

I'm guessing that's it's a syntax error or something that I'm leaving
out, but after 2 days it's really been frustrating me, so a 2nd set of
eyes would be very helpful!

Addl. info... I'm using WinXP, IE 6.0

Thanks
-Matt

Request for Question Clarification by arimathea-ga on 25 Jun 2003 10:12 PDT
mbriney-ga,

The only real syntax error I could find with your Stylesheet was that
this is specified incorrectly:

.blueform {
BACKGROUND:CFDCE9;
}

I noticed that it appears that every link on the page goes to a single
file - I am assuming this is a mockup, and the correct behavior.  
Please clarify for me - when you are clicking on the link, you go to a
"file not found" (404) page, right?  And then you click back on the
Browser, and the styles are incorrect?  What happens when you specify
the stylesheet with an absolute path?

Clarification of Question by mbriney-ga on 25 Jun 2003 10:33 PDT
Yes, when you click on a link you should get a 404 error page.

Then when you press the back button on your browser the styles are incorrect.

I tried creating a direct link to the CSS but nothing changed, same behavior.

Request for Question Clarification by hammer-ga on 25 Jun 2003 10:42 PDT
I bet I know what's going on. Since all the links go to the same
place, once you click on any one of them, they all become "visited",
taking on those properties. Try making soem of the links go somewhere
else and see if they also lose their properties when you go Back.

- Hammer

Request for Question Clarification by hammer-ga on 25 Jun 2003 11:39 PDT
MBriney,

If my information or sgtcory-ga's information were of help to you,
please post a clarification letting us know which of us may post the
official "answer". If not, please let us know anyway, so that we can
continue troubleshooting your problem.

Best regards,

- Hammer

Clarification of Question by mbriney-ga on 25 Jun 2003 11:40 PDT
I think you're definitely right, it is only to the visited links.

I created a page: http://www.teladesign.net/newtcs/index-example.htm
In the right sidebar area (else where) each entry has 2 links, each of
the links are different.

If you click on one link and go back that link's style changes, but
the other stays the same.
Answer  
Subject: Re: Problem with CSS Style Sheets
Answered By: hammer-ga on 25 Jun 2003 12:09 PDT
Rated:4 out of 5 stars
 
MBriney,

In this case, what you believed to be an error in your style sheet was
just a false symptom showing up because your test page was a mockup.

Since all the links on your test page go to the same place, once you
click on any one of them, they all become "visited". Once this
happens, they will all display the properties specified for a visited
link, making it look like your entire page is incorrect.

According to your clarification, changing some of the links to go to
other places prevented those links from losing their style. Once your
page is populated with real links, your problems should go away.

You can also control the style of visited links using CSS, or using
the technique described below by Sgtcory-ga. If you need information
on controlling visited links using CSS, take a look at this tutorial:

EchEcho.com - CSS Links
http://www.echoecho.com/csslinks.htm

Google Search Strategy:
None - I recognized this immediately from having done it myself! :>


- Hammer

Clarification of Answer by hammer-ga on 25 Jun 2003 14:38 PDT
MBriney,

Re your comment below...

If you are explicitly setting the visited tag in your style (which I
believe you are), it will override the vlink setting. You need to make
your change in the stylesheet. Take a look at the tutorial in my
answer. It includes some examples of how to set the visited
properties.

Also, if you use the Request Clarification feature, rather than
posting a comment, I will be notified that you need further help.

- Hammer

Clarification of Answer by hammer-ga on 25 Jun 2003 14:58 PDT
MBriney,

I just went and looked at your current test pages. I see a link
"Failing The Test", which I'm guessing is the one you're working with.
I don't see a VLINK in your page BODY tag, nor do I see a:visited in
the headline style in your style sheet. Put a VLINK in your BODY tag
to suggest a color for those browsers that do not support CSS, and add
a:visited to the headline style.

- Hammer
mbriney-ga rated this answer:4 out of 5 stars
The tutorial on CSS was very helpful!  I had looked at others and they
were not as detailed.  Thanks for all your help!

Comments  
Subject: Re: Problem with CSS Style Sheets
From: mvguy-ga on 25 Jun 2003 10:25 PDT
 
I don't have an answer for you, but the problem is the same in both
Opera 7 and Mozilla Firebird 0.6, so this probably isn't a browser
bug.  I'm baffled, which means the answer must be obvious somewhere.
Subject: Re: Problem with CSS Style Sheets
From: sgtcory-ga on 25 Jun 2003 11:31 PDT
 
I agree with Hammer. Your links all become visited. If you wish to
have a uniform look for all your visted links (once you get them going
somewhere else other than one file/link), you should simply desiginate
a visited link color in the body portion of your HTML :


Old style applies black to all links visited (#000000)

<body bgcolor="#FFFFFF" text="#000000" link="#000000" leftmargin="0"
topmargin="0" marginwidth="0" marginheight="0">


Leave the above the same, simply add (vlink="#669900")

<body bgcolor="#FFFFFF" text="#000000" link="#000000" vlink="#669900"
leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">

Of course you can change the vlink to whatever color you like ;-)

SgtCory
Subject: Re: Problem with CSS Style Sheets
From: mvguy-ga on 25 Jun 2003 12:23 PDT
 
That explains it. As I suspected, now that I know the answer it seems
pretty obvious.
Subject: Re: Problem with CSS Style Sheets
From: mbriney-ga on 25 Jun 2003 14:05 PDT
 
I added the vlink property to the body tag, but it still didn't fix
the problem with the style sheets.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy