This Message Forum is no longer in use

Please use the new Bravenet Help Forums FOUND HERE

General Forum
This Forum is Locked
Author
Comment
Web Colours Changing when Doctype Code Added

Hi
Can anyone advise me why the colors on this page change when I add the line to the code.

The page should be black with green boxes etc but when the line is added everything goes mostly white, when I remove the doctype line the page returns to normal.
Thank-you

http://teamblackhorse-yamaha.com/indextest.html

Browser: IE7

Re: Web Colours Changing when Doctype Code Added

Check the color definitions in your "style.css" file. All color references need to have a "#" at the start.

Without the DOCTYPE tag you are in quirks mode, and the interpretation of color values is more relaxed. Colors are accepted even though they are specified incorrectly.

However when you add a DOCTYPE, it puts your page in a standards compliant mode and all declarations need to be correct.

For example, the style for "body" says the following in your "style.css" file. Note the background color definition.

Code:
body
{
font: 0.8em Trebuchet MS, Arial, Sans Serif;
<span style="font-weight:bold;">background-color: 000000;</span>
margin: 0px;
padding: 10px 0px;
}


Change it to read like the following and your background color will be restored. Do the same for all your other color definitions.

Code:
body
{
font: 0.8em Trebuchet MS, Arial, Sans Serif;
<span style="font-weight:bold;">background-color: #000000;</span>
margin: 0px;
padding: 10px 0px;
}

Browser: Firefox, Netscape, Sea Monkey, Internet Explorer, .....

OS: Solaris (Sparc,x86), Linux, XP

Re: Web Colours Changing when Doctype Code Added

Many thanks Philo.
Much appreciated

Browser: IE7