0

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?

2 Answers 2

0

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)
1
1

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.

2
  • 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! Commented Jul 5, 2011 at 9:15
  • Don't get why is the other answer accepted as the good one for the topic...
    – kevin
    Commented Jul 7, 2011 at 14:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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