Jump to content

<span color=""> I think is wrong


blogsmith
 Share

Recommended Posts

Well, I don't think that's deprecated, in fact I think that should work. But I've never used rgb myself, I always use hex, which is widely supported. 192 in hex is C0, so you can write the same thing like this:<span style="color: #C0C0C0;"></span>If you need to convert from decimal to hex, you can either fire up your chosen image editing program like Paint Shop Pro or Photoshop and do it there, or you can open the Windows calculator, select scientific mode (View -> Scientific), make sure the "Dec" radio button is checked, type in your number, and hit the "Hex" radio button to convert.

Link to comment
Share on other sites

It certainly isn't deprecated, it's just as you should declare color. The "font" tag is what is deprecated.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html><head><title>Untitled document</title></head><body>[b]<span style="color: rgb(192, 192, 192);">Books from Amazon</span>[/b]</body></html>

Put that code in the textbox here:http://validator.w3.org/and you'll see that it's indeed valid xhtml. :)

Link to comment
Share on other sites

you don't need to use the hex identifier (#) in making your statement:<span style="color:c0c0c0"><p>test</p></span>will get you where you want to go.

Where You get that? Hex idtenfier MUST be there! It does not mean if it works with MSIE without that identifier, it can be throwed out of the code! :) Test it by pushing hereInvalid number : color c0c0c0 is not a color value : c0c0c0If HEX colors are used there MUST be always # -mark with value.
Link to comment
Share on other sites

as a follow up, i was using span and color in a different way. interestingly enough, i validated the following code on w3:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><title>Title</title></head><body><h1>test <span style="color:00ff00">test this phrase</span> head</h1></body></html>

and it passed just fine. however, it did not display properly in either firefox or i.e. once the hex identifier was added, it displayed as expected.interesting.

Link to comment
Share on other sites

I think perhaps the (x)html validator just validates html stuff, so the content within the style attribute should be validated by the css validator.

Link to comment
Share on other sites

jonas is kerrect...the css validator did complain about the lack of a hex identifier.i guess this should be a warning to be careful if you specify css styles within an html page or inline within an element. if you don't use the hex your colors :) will not be blest.coder beware! :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...