Jump to content

No more <td background> so do I use CSS?


Recommended Posts

Hi all,

 

I put the W3C Markup Validation checker against my site, and was slapped with 59 errors.  After diligently cleaning it up, I'm down to one last error...  apparently XHTML 1.0 won't support using the 'background' element within a <td> tag anymore.  Correct?

 

I'm assuming the answer is CSS.  I've got an external CSS sheet attached to my main template, but I'm not sure how to go about placing the background image into a class.  Basically I have a few images I need to appear in certain cells of my table, and I need to write text over them.

 

Sorry if this is confusing, but I'm kinda new to CSS and I'm still not comfortable with it.

Thanks in advance.

 

Link to comment
https://forums.phpfreaks.com/topic/88059-no-more-so-do-i-use-css/
Share on other sites

Yes CSS is the way to go I have been messing with it for the past couple of days, learned a little bit about it.

 

this site here has helped me tremendously

http://www.w3schools.com/css/default.asp

I mainly go to the CSS2 Reference section and CTRL+F to find what i want

 

CSS Help on background

http://www.w3schools.com/css/pr_background.asp

 

the answer to your problem i think is

 

Same image in all cells (its either table.td or table td)

table.td {
background: url(IMAGEURL) no-repeat top left;
}

 

Different Image in cells you specify

HTML:

<td id='image1'>

CSS:

#image1 {
background: url(IMAGEURL) no-repeat top left;
}

 

and just make #image2 or which ever you want to call it each time you want a different background for a different <td>

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.