Jump to content
xisto Community
Sign in to follow this  
leiaah

Use Cell Background Image On Css?

Recommended Posts

I wanted to have a button that changes the skin/theme of my site using css and php. I've already had the php code for switching between two different css but I don't know how to put an image background for each cell using css.Can anyone help me? Sample codes would be nice. :P

Share this post


Link to post
Share on other sites

Some browsers support the background attribute in <TD> tags, but it is not a part of the standard.. meaning it will not validate under HTML4.01 or XHTML.. But that's not what you're looking for...

To do the same with CSS you can use the style attribute combined with the 'background-image' property as in:

<table> <tr>   <td style="background-image: url(relative_path/my_image.gif)">My Cell</td> </tr></table>

The code above will validate under both HTML 4.01 and XHTML..

I hope that helps!

Share this post


Link to post
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
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.