Printing html ignores CSS stylesheets

前端 未结 3 1305
礼貌的吻别
礼貌的吻别 2021-01-11 16:48

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

The document is styled with css. When I print the page it looks like there are no stylesheets at all. Wrong fon

相关标签:
3条回答
  • 2021-01-11 17:16

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

    0 讨论(0)
  • 2021-01-11 17:21

    If your stylesheet link has media="screen", then it will be ignored by print. In that case you can create a separate print stylesheet with media="print" or just change your existing style sheet to media="all".

    0 讨论(0)
  • 2021-01-11 17:29

    Without the link to the page, I can only offer 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 all media type will work across web and print. However, if you wanted to explicitly state another stylesheet for print than replace the all with print.

    • Check to see if the style are not being overridden by something else. As CSS is Cascading Style Sheets
    • Get Firebug.
    0 讨论(0)
提交回复
热议问题