943,520 Members | Top Members by Rank

Ad:
Sep 2nd, 2008
0

XHTML: No more cell background images?

Expand Post »
I was just at validator.w3.org testing my site, and it found <td background='bricks.jpg'> as an invalid tag. It said Line 25, Column 29: there is no attribute "background".

I am using XHTML 1.0 Transitional.

Did they really do away with image backgrounds? I can't imagine that they'd want pages to be black and white.

Am I missing something here?

I'm making a webpage for a person, and I want it to be compliant with all browsers, so I was striving to make it XHTML compliant.

He wants a brick pattern as the background for his left ajax menu, but the validator won't let me. What's going on?

Any help is greatly appreciated.
Reputation Points: 50
Solved Threads: 0
Junior Poster in Training
Diode is offline Offline
70 posts
since Jan 2005
Sep 2nd, 2008
0

Re: XHTML: No more cell background images?

Hi,
I have viewed My Websites in 4 different browsers and I have never seen a problem going against that code error. I will check yours for you if you would like I wanted to add that I think they are trying to get people to use css for the backgrounds in tables instead of relying on the HTML code.
Last edited by tiger86; Sep 2nd, 2008 at 3:59 am.
Reputation Points: 48
Solved Threads: 11
Posting Pro
tiger86 is offline Offline
540 posts
since Feb 2008
Sep 2nd, 2008
0

Re: XHTML: No more cell background images?

In XHTML, the background and bgcolor attributes have been deprecated. This is because they can easily be implemented with css. If you want it to validate, use
HTML Syntax (Toggle Plain Text)
  1. <td style="background-image:url(bricks.jpg)">
However, the best way to do this would be to put these sort of styles in an external stylesheet. This way, it can be cached by the browser and not retrieved repeatedly for each concurrent page that uses the style. This will not only clean up your html, but will also cut down on page load time resulting in a better experience for the user.
Reputation Points: 232
Solved Threads: 137
Practically a Master Poster
buddylee17 is offline Offline
665 posts
since Nov 2007
Sep 2nd, 2008
0

Re: XHTML: No more cell background images?

Thanks for your replies. BuddyLee: I tried that in an external style sheet but it doesn't load the image on the page. Know why? Here is my tag for it:

HTML and CSS Syntax (Toggle Plain Text)
  1. TD.MAINCELL{
  2. FONT-WEIGHT: bold; FONT-SIZE: 105%; background-image: url("bricks.jpg"); BACKGROUND: white; COLOR: blue; FONT-FAMILY: "arial", sans-serif
  3. }

Thanks
Reputation Points: 50
Solved Threads: 0
Junior Poster in Training
Diode is offline Offline
70 posts
since Jan 2005
Sep 2nd, 2008
0

Re: XHTML: No more cell background images?

Put the background attribute before the background image. This has to do with the order the browser applies the attribute styles in. I would also try to get away from using all caps for the attributes.
CSS Syntax (Toggle Plain Text)
  1. TD.MAINCELL{
  2. font-weight: bold;
  3. font-size: 105%;
  4. background: white;
  5. background-image: url("bricks.jpg");
  6. color: blue;
  7. font-family: "arial", sans-serif
  8. }
Reputation Points: 232
Solved Threads: 137
Practically a Master Poster
buddylee17 is offline Offline
665 posts
since Nov 2007
Sep 3rd, 2008
0

Re: XHTML: No more cell background images?

Thanks for your help guys, the CSS worked.
Reputation Points: 50
Solved Threads: 0
Junior Poster in Training
Diode is offline Offline
70 posts
since Jan 2005
Sep 5th, 2008
0

Re: XHTML: No more cell background images?

Click to Expand / Collapse  Quote originally posted by Diode ...
Thanks for your replies. BuddyLee: I tried that in an external style sheet but it doesn't load the image on the page. Know why? Here is my tag for it:

HTML and CSS Syntax (Toggle Plain Text)
  1. TD.MAINCELL{
  2. FONT-WEIGHT: bold; FONT-SIZE: 105%; background-image: url("bricks.jpg"); BACKGROUND: white; COLOR: blue; FONT-FAMILY: "arial", sans-serif
  3. }

Thanks
Capital letters are not allowed in styles, attributes, and tags in xhtml.
Reputation Points: 730
Solved Threads: 181
Nearly a Senior Poster
MidiMagic is offline Offline
3,314 posts
since Jan 2007

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in HTML and CSS Forum Timeline: keeping a consistant line-height when using super-script
Next Thread in HTML and CSS Forum Timeline: CSS in EI and Firefox - HELP! PLEASE!





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC