Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print HTML with CSS

Status
Not open for further replies.

IlseDC

Programmer
Mar 24, 2003
49
BE
I'm new on HTML and CSS.
I have made a HTML page with attributes in a CSS file (background color of table rows and columns, ...).
When I print the HTML page there are no colors on the printout. So the settings from the CSS are not used when the HTML is printed.
Is there a solution for this?

 
Look for information on CSS related to different media types.
For example this two links can exist on top of your pages and when sending to the printer the second one will be used.

<link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; media=&quot;all&quot; href=&quot;main.css&quot; />

<link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; media=&quot;print&quot; href=&quot;print.css&quot; />

 
@Media properties werent supported by any browsers last time i looked (although i admit that was a good while ago lol).

[bobafett] BobbaFet [bobafett]

Everyone has a right to my opinion.
E-mail me at caswegkamp@hotmail.com
 
Check your browser settings. In IE, look at Tools/Internet Oprions..., click the [Advanced] tag and scroll down till you see the &quot;Printing&quot; options. If &quot;Print background colors and images&quot; is unchecked, you won't get any - whatever your CSS says. Other browsers have similar features.

grtfercho's approach of using different stylesheets for different media, and bobbafet's allusion to @media directives are both powerful tools, but current support of both approaches is distinctly flaky. Browsers have nasty habits of ignoring rules they should be applying, or applying rules they should be ignoring given a particular media type. I'm afraid we're still stuck with providing seperate &quot;printer friendly&quot; pages for the time being.

-- Chris Hunt
Extra Connections Ltd
 
play nice man... we are here to get some tech advice and help each other not to get drops of mild sarcasm...

:) :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top