Style on TD question

Posted on 2003-02-19
Medium Priority
Last Modified: 2010-04-09
My web page uses this piece of code:

<td style="background-image: url('images/backgrd.gif')">

to set a background image on a table's <TD> tag.

The problem is that when trying to print the page, this image does not show. Is there another way of setting a background image on a <TD> or somehow to remedy the problem with not showing on printing?

Question by:poutses
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 18

Expert Comment

ID: 7983099
you have to set your browser to print background colors and images... which i don't believe you can do programmatically.

anyway, to do it in IE, go to tools->internet options->advanced tab: scroll down to Printing and check "Print background colors and images"

Expert Comment

ID: 7983955
Thats correct there is no way to do it code wise   however every browser (that i can think of) allows you to turn on the printing of images and background colors.

Expert Comment

ID: 7984461
yep... thats it... no other way....

WordPress Tutorial 4: Recommended Plugins

Now that you have WordPress installed, understand the interface, and know how to install new parts, let’s take a look at our recommended plugins.


Expert Comment

ID: 7985730
you can set a background image to <td> tag also like this, and without styles:

<td background="images/backgrd.gif">

Expert Comment

ID: 7987155
There is no way to do so in the code, you can only tell the user to turn it on if they want the bg's printed.

If the printing is vital, you can always use the <img> tag to get the image in the cell.

If it has text over the background, you can add it in an image editor to the image and use the <img> tag.

Expert Comment

ID: 7989277
If you absolutely must have the image print, no matter what the user's settings are, use CSS to absolutely position the image relative to the table cell, and then absolutely position the text over it.

This is the way to do it only if you can't put the text on the image for some reason...which is much easier, as someone above suggested.

Accepted Solution

Jonza earned 200 total points
ID: 7991808
if you really want to make that background to show in printing and it doesn't show when on <td> background do it like this.

instead of
<td background='someimage.gif' width='400' height='0'></td>

do it like this: create a new table and put the background there.
<td> <!-- this is the cell you wanted the background on -->
<table border='0' cellpadding='0' cellspacing='0' width='400' height='400' background='someimage.gif'>
   <tr align='left' valign='top'>
      <td>Now your text here =)</td>

the height and width are just example values..

Featured Post

7 Extremely Useful Linux Commands for Beginners

Just getting started with Linux? Here's a quick start guide that has 7 commands that we believe will come in handy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question