View Full Version : Background Color is not displayed when back button is pressed.

Graham Petrie
08-08-2002, 09:58 PM
Could someone please check this out for (to make sure I am not seeing things) and try to sort the problem out for me.

When on my site (http://www.knightguider.orcon.net.nz) and I click on the "What's On" link at the top of the page, wait for the page to load, and then click the back button. The startpage loses it's background colour.

I am using the following style sheet to specify the background colour:

kg.css follows

font-family: sans-serif;
font-weight: bold;
font-size: 12pt;
background-color: #ffffcc;

The code for the site can be viewed as normal.


08-08-2002, 10:00 PM
Yep - sure does.

Neat trick, if only you could figure out how you did it..

Graham Petrie
08-08-2002, 10:02 PM
I think it has something to d with the style sheet not loading the color again on back. A refresh (no ctrl key required) fixes it. How the heck is it doing it???? Didn't used to - only since I added the what's on link, but every link causes the problem.


08-08-2002, 10:05 PM
I dont know much about HTML but you could try an absolute path the the .css file.

Babe Ruth
08-08-2002, 10:08 PM
GP, I'm using Mozilla and I don't see any background colour (except white). That includes the first loading of the page and regardless of moving back/forward or refresh/reload. What colour was it supposed to be?


Graham Petrie
08-08-2002, 10:09 PM
OK, just tried that, but it didn't work.



Graham Petrie
08-08-2002, 10:31 PM
Light yellow (same as the backgound of the images). Does Mozilla support .css style sheets? Some browsers don't, and just apply the normal formatting - I guess that is one disadvantage of using them. Still alot better than the <font> tags as far as the author of the site is concerned


Babe Ruth
08-08-2002, 10:49 PM
GP, Yup Cascading Style Sheets: * CSS1 * CSS2 (partial support at this time)

Heather P
08-08-2002, 11:00 PM
Had a look at it with Homesite and used the Document Validator. There are several minor errors with your code. Try hunting for a validator on the web to spot your errors. One of these errors may, for some obscure reason, be causing the fault.

Elwin Way
08-08-2002, 11:02 PM

A work around, and a also a way to keep cross browser compatibility, is to also specifiy background colour in the them tags eg:

<BODY background=#ffffcc>

Also, it is better (theoretically) to place style definitions within the HTML page rather as a link:
<style type="text/css">
body {
background-color: #FFFFCC;

Of course not many people do this because it is way easier to edit one external style sheet than every style on every page...

Elwin Way
08-08-2002, 11:04 PM
Mental note: PREVIEW !

First line of code should be:

<body bgcolor="#FFFFCC">

Elwin Way
08-08-2002, 11:07 PM
Heather - different validators give different results - it depends on how up to date they are, and which standard they are conforming to. I kid you not! There are several standards...

I can't see anything wrong with the code apart from the
should not be there and the extra spaces in the words...

Graham Petrie
08-08-2002, 11:07 PM
Thanks Elwin - I was just trying to save time copy and pasting all of the body style stuff (as you say it is easy with an external sheet). As you may have nopticed the scrollbars etc also disappear with the back button.

I don't want to have to copy and paste all of that info into each page too. There must be another way.

Thanks anyway - I know about style tags in the html and also about the bgcolor tag.


Heather P
08-08-2002, 11:16 PM

The advantages of a validator....

The odd </a> missing
Tables within paragraphs

Minor stuff, but as there is an error worth looking into (SOMETHING is causing it from one page only)

Graham Petrie
08-08-2002, 11:21 PM
AHA! Having the imag at the top of the page was for some reason stopping the browser from seing the <link> tag on the back button. Working now.

Thanks Heather - it took a bit of playing with a vlidator, but all OK now.


Elwin Way
08-08-2002, 11:26 PM
Apologies Heather, I forget .. I do my own validating with my eyes..

GP: Use an external style sheet editor like TopStyle. Ther eis a lite free version. It will save (and preview) your style sheets to which you then link to by putting :

<link href="stylesheet.css" rel="stylesheet" type="text/css">

in the <head> section on every page.

This way when you want to change, say the back ground colour, you only do it via the external sheet. (I'm doing this so the others can follow)

Heather P
08-08-2002, 11:33 PM

I also use eyes. But when all else fails.... particularly if it's someone else's page that I haven't worked on...

Elwin Way
09-08-2002, 01:00 PM

It boils down to the amount of knowledge and experience one has. I can look at the results of a validator and think, "I can get away with that" or "there's nothing wrong with that", because I know better. My human brain works more flexibly that a validator that has been programmed to recognise a specific 'mind set' if you like.

On the other hand, any decent HTML editor will pick up typos on sight. And using something like TopStyle, you don't even have to look at the code!

Heather P
09-08-2002, 01:10 PM
Actually thought about it later. Things like paragraphs ending is irrelevant - the end tag is optional. But there were anchors in table cells that didn't end. The cell itself ended it. Bet that's where the problem was.

Although in theory it shouldn't have affected the style sheet crossed tags and unended ones could well be causing it.

Elwin Way
09-08-2002, 02:11 PM
Umm, I've a confession to make. I never went to the site in question. I just looked at the style definitions that were posted. :8}