Jump to content

<table>, background in w3school pages


bdt
 Share

Recommended Posts

I have a question/comment about the background attribute. Background is not listed as an attribute for the <table> tag at w3schools; bgcolor is there, but I don't see an attribute to add a background image. However, there is a link in the 'Try-It-Yourself Demos' section (http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_table_background) which shows the use of a background attribute. But when I try to use background this way in a page, it won't validate as HTML 4.01 Transitional. The page looks OK in IE6 and Firefox 1.5, but it won't validate.I resolved my immediate problem with some CSS, but I'm trying to figure out how this is supposed to work and the w3school approach just confuses me more. What am I missing? thanks

Link to comment
Share on other sites

I think vchris is right. You could add it in with inline styles though, eg:

<table style="background-image: url(/url/to/image.ext);"><tr><td>Hello</td></tr></table>

That should work. You could also add it using CSS styles as well, by adding in an ID or CLASS.

Link to comment
Share on other sites

Yep, I did fix it with CSS background-image and it's just fine. I was just suprised that the HTML tag descriptions at w3school didn't even mention 'Background' related to <table> or <td> and say that it was deprecated. The only place that I noticed it was related to <body> and there it is defined as deprecated.

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...