Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Why is my table row background image not appearing in Wordpress.

Is the stylesheet for the theme suppressing it in some way and if so, how can one override that to make the image show, or is there some other fault causing it not to appear?

Note the other image in the table does display properly so the path to the files seems to work ok.

<table width="250" height="200" cellpadding="0" cellspacing="0" border="1">
<tr>
    <td WIDTH="250" HEIGHT="82" colspan="3"><img src="/wp-content/plugins/xxxxxxwidget/image1.png">
        </td>
</tr>
<tr>
    <td style="background-image:url(/wp-content/plugins/xxxxxxwidget/image2.png) no-repeat center;" WIDTH="250" HEIGHT="45" colspan="3">
        </td>
    </tr>
</table>

Any suggestions?

share|improve this question

2 Answers 2

up vote 0 down vote accepted

What does Firebug or Chrome Developer Tools report on the rendered background image URL? Does it return a 404?

Try changing this:

style="background-image:url(/wp-content/plugins/xxxxxxwidget/image2.png)

to this:

style="background-image:url(<?php echo wp_plugins_dir(); ?>/xxxxxxwidget/image2.png)
share|improve this answer
    
As I said in my original text it's NOT the path that is at fault. I have also tried replacing it with: style="background-image:url(localhost/wp-content/plugins/xxxxxxwidget/image2.png) –  Cheeky Cherub Jul 4 '11 at 19:54

Css syntax wrong here:

<td style="background-image:url(/wp-content/plugins/xxxxxxwidget/image2.png) no-repeat center;" WIDTH="250" HEIGHT="45" colspan="3">
        </td>

'background-image' accepts only an url, no other parameters such as no-repeat and center. Use instead:

<td style="background:url(/wp-content/plugins/xxxxxxwidget/image2.png) no-repeat center;" WIDTH="250" HEIGHT="45" colspan="3">
        </td>

Should help.

share|improve this answer
    
The worst thing is, I had originally put background but someone else told me to change it...typical, LOL - Thank you so much, that worked a treat, you have saved my life! –  Cheeky Cherub Jul 5 '11 at 9:15
    
Don't get why is the other answer accepted as the good one for the topic... –  kevin Jul 7 '11 at 14:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.