Html print ignores CSS styles

I have a very simple html page with a table element.

The document is issued by css. When I print the page, it looks like there are no styles at all. Invalid font, everything is wrong.

What is the problem? Do I need to create custom CSS just for printing? In my case, it will be the same. Is it really necessary?

+4
source share
3 answers

Without a link to the page, I can offer only a little advice.

  • Make sure the link to the stylesheet in the header is correct. And it should look something like this:

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

I just noticed that you mentioned print . The media type all will work over the Internet and print. However, if you want to explicitly specify a different stylesheet for print , than replace all with print .

  • Make sure the style is not overridden by anything else. Because CSS is Cascading Style Sheets
  • Get Firebug.
+14
source

If your stylesheet has media="screen" , then printing will be ignored. In this case, you can create a separate print stylesheet using media="print" or simply change the existing stylesheet to media="all" .

0
source

The media attribute is used to determine the purpose of the style sheet. You must make sure that it is set to all (for all purposes) or print (used only when printing).

0
source