How to generate a table so that the background color is grey on a printout

S

Stefan Mueller

I'd like to generate with PHP a HTML email which contains a table.
The backgound color of the table is grey. But if you print the email or HTML
page on a printer the background color of the table is not printed.

td.style_tabletitle {
font-family: verdana;
font-size: 8pt;
font-weight: bold;
color: #000000;
background-color: #666666;
}

<td width = "100%" class = "style_tabletitle">
My table title
</td>

Is there any possibility to define the background of the table so that the
background is also printed (only a light grey)?

Stefan
 
B

Barbara de Zoete

Is there any possibility to define the background of the table so that
the background is also printed (only a light grey)?

There shouldn't be. You can suggest a grey background for the table in
your style sheet for printing, but it is up to the visitor/user whether or
not s/he wants the background colour actually printed. If so s/he will set
it in the browser preferences. If not, too bad.


--
,-- --<--@ -- PretLetters: 'woest wyf', met vele interesses: ----------.
| weblog | http://home.wanadoo.nl/b.de.zoete/_private/weblog.html |
| webontwerp | http://home.wanadoo.nl/b.de.zoete/html/webontwerp.html |
|zweefvliegen | http://home.wanadoo.nl/b.de.zoete/html/vliegen.html |
`-------------------------------------------------- --<--@ ------------'
 
D

Dylan Parry

Pondering the eternal question of "Hobnobs or Rich Tea?", Stefan Mueller
finally proclaimed:
background color of the table is not printed.

This is a browser setting that you can only change for your own machine,
so nothing you do will make the background print on other peoples'
printers unless you go round to their houses and reconfigure their
browsers ;)
 
J

Jim Higson

Stefan said:
I'd like to generate with PHP a HTML email which contains a table.
The backgound color of the table is grey. But if you print the email or
HTML page on a printer the background color of the table is not printed.

td.style_tabletitle {
font-family: verdana;
font-size: 8pt;
font-weight: bold;
color: #000000;
background-color: #666666;
}

<td width = "100%" class = "style_tabletitle">
My table title
</td>

Is there any possibility to define the background of the table so that the
background is also printed (only a light grey)?

Nope. In theory you can do this with CSS media selectors, but a lot of email
clients (webmail ones especially) don't use CSS very well.

See:
http://www.alistapart.com/articles/cssemail/

The user's email client might strip the background out anyway, but probably
can't be relied on. Better to use print friendly colours to start with or
just send plain text emails.
 
W

wayne

Stefan said:
I'd like to generate with PHP a HTML email which contains a table.
The backgound color of the table is grey. But if you print the email or HTML
page on a printer the background color of the table is not printed.

td.style_tabletitle {
font-family: verdana;
font-size: 8pt;
font-weight: bold;
color: #000000;
background-color: #666666;
}

<td width = "100%" class = "style_tabletitle">
My table title
</td>

Is there any possibility to define the background of the table so that the
background is also printed (only a light grey)?

Stefan
Try this in your style sheet:

@media print {
td.style_tabletitle {
background-color: #ffffff !important;

}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top