magnetica Posted August 15, 2009 Share Posted August 15, 2009 Hi simple question. I'm setting a background color on a div and when I put the <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> the background color disappears? Whys this? Thanks Link to comment https://forums.phpfreaks.com/topic/170381-solved-doctype-and-div-bgcolors/ Share on other sites More sharing options...
magnetica Posted August 15, 2009 Author Share Posted August 15, 2009 Sorry heres the css: #content { width: 795px; background-color: f9dc6e; margin: 0px; padding: 10px; } Link to comment https://forums.phpfreaks.com/topic/170381-solved-doctype-and-div-bgcolors/#findComment-898792 Share on other sites More sharing options...
DEVILofDARKNESS Posted August 15, 2009 Share Posted August 15, 2009 I also had problems with the doctypes, I simply solved this by using this: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> Link to comment https://forums.phpfreaks.com/topic/170381-solved-doctype-and-div-bgcolors/#findComment-898807 Share on other sites More sharing options...
magnetica Posted August 15, 2009 Author Share Posted August 15, 2009 Simple as that sometimes. Thanks Link to comment https://forums.phpfreaks.com/topic/170381-solved-doctype-and-div-bgcolors/#findComment-898816 Share on other sites More sharing options...
haku Posted August 17, 2009 Share Posted August 17, 2009 Your problem was here: background-color: f9dc6e; Should be: background-color: #f9dc6e; The doctype just meant that the browser started checking it by rules, and you were breaking the rules by not having the pound sign (#) in front of the hexidecimal code, so it stopped displaying it. Link to comment https://forums.phpfreaks.com/topic/170381-solved-doctype-and-div-bgcolors/#findComment-899729 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.