Follow by Email

Sunday, June 9, 2013

Printing web page with CCS applied

I was trying to print a web page which has only a normal HTML table in it and was getting crazy by the fact that whenever I print it using browser's ctrl+p button it was always ignoring all the CSS applied to the page.

I only found out in the below discussion that while including style sheet to your web page if you don't define any value for "media" attribute or if you define it as "media=screen" the CSS will not be applied when you try to take the print out of this page

http://stackoverflow.com/questions/6921573/is-there-no-difference-between-no-media-and-media-all-in-css-link/6921600#6921600

So for me the solution was to include my stylesheet as

<link rel="stylesheet" media="all" type="text/css" href="MyStyleSheet.css" />

No comments:

Post a Comment