webmaster Posted September 14, 2009 Share Posted September 14, 2009 I am having a problem with firefox and rgb colors. I am trying to make the body color be red using bgcolor, using the following code: <body bgcolor="rgb(255,0,0)">, and the color is instead some shade of green. What am I doing wrong? Link to comment Share on other sites More sharing options...
jeffman Posted September 14, 2009 Share Posted September 14, 2009 Read the message! bgcolor is not a supported attribute that you put in an element <tag>. You must use CSS. The property you want to mess with is background-color. FWIW, most developers use hex notation for color, so pure red = "#f00" or "#ff0000" Link to comment Share on other sites More sharing options...
webmaster Posted September 14, 2009 Author Share Posted September 14, 2009 Deprecated, yes, but still validates under xhtml transitional DTD and still works in all browsers. According to w3schools, rgb values are supported in bgcolor attributes. Link to comment Share on other sites More sharing options...
thescientist Posted September 14, 2009 Share Posted September 14, 2009 Personally, I would only ever use a Strict DTD so as to ensure proper compatibility across all browsers. And besides, like DD pointed, the whole idea behind modern web browsing is to separate the HTML and CSS. Link to comment Share on other sites More sharing options...
webmaster Posted September 14, 2009 Author Share Posted September 14, 2009 I am using this for a personal page that is not going to be published, more for experimental purposes. The rgb values work fine in IE, but not in Firefox. They should work, regardless of being proper. Link to comment Share on other sites More sharing options...
Ingolme Posted September 14, 2009 Share Posted September 14, 2009 Well, if your observations are showing that they don't work then there's no other possibility. Browser support for bgcolor using RGB values is very limited these days.In HTML, deprecated elements and attributes are ones that are only supported for backwards compatibility. Link to comment Share on other sites More sharing options...
Synook Posted September 14, 2009 Share Posted September 14, 2009 They should work, regardless of being proper.Unless its specifically stated in a current standard that an acceptable value for the bgcolor attribute is an RGB function, then you can't expect it to work.The HTML 4.01 specification states that the bgcolor attribute accepts a value of type color. [1]Looking up the color type, the W3C specifies that it is as thus:6.5 ColorsThe attribute value type "color" (%Color;) refers to color definitions as specified in [sRGB]. A color value may either be a hexadecimal number (prefixed by a hash mark) or one of the following sixteen color names. The color names are case-insensitive.This does not include RGB functions. Therefore, you cannot expect an RGB function to be recognised as a valid value for the bgcolor attribute. Link to comment Share on other sites More sharing options...
thescientist Posted September 14, 2009 Share Posted September 14, 2009 I am using this for a personal page that is not going to be published, more for experimental purposes. The rgb values work fine in IE, but not in Firefox. They should work, regardless of being proper.still don't see you wouldn't want to follow proper coding techniques/standards. they are there for a reason, and you will only become a better developer for it. For personal or professional reasons regardless, there is typically a right and wrong way to do things. Since your starting out, I would start trying to learn the right way of doing things. It will just make your evolution as a designer that much easier and graceful. Link to comment Share on other sites More sharing options...
ravenshade Posted September 15, 2009 Share Posted September 15, 2009 Deprecated stuff is evil... using Hex values gains more compatability, but you can also use just normal colours, like "green". Firefox version 3 last time I checked does not support RGB values, but it does support the bgcolor="". The customized browser at my university always updates to the latest version of HTML etc and ignores deprecated tags completely. So it's always best to stay up to date and try to avoid deprecated tags if possible. Link to comment Share on other sites More sharing options...
Guest FirefoxRocks Posted September 16, 2009 Share Posted September 16, 2009 Personally there's only 2 valid issues I can think of for using Transitional vs Strict document types:1. <iframe>2. target=""Iframes can be put in conditional comments instead, although valid it isn't truly valid.Target can be reproduced using JavaScript but again, it is like tricking the validator and also it is less compatible. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.