How to get a background image to print using css?

后端 未结 10 514
再見小時候
再見小時候 2020-11-27 18:21

I am using the ASP Net Sprites package to create CSS Sprites on my website.

It is working, but the images it generates do not appear when printed.

The code g

相关标签:
10条回答
  • 2020-11-27 19:03

    set media="print"

    <LINK REL="stylesheet" TYPE="text/css" MEDIA="print, handheld" HREF="foo.css">
    

    Reference

    0 讨论(0)
  • 2020-11-27 19:07

    When you are trying custom printing through creating print format directly with java script and if there is tag is there then it won’t be print because browser intensely send request to printer without waiting to load image in cache. So good practice add image which you want to print on html page and make it visibility false.

    0 讨论(0)
  • 2020-11-27 19:09

    If you use Internet Explorer, this is how you do it:

    • Go to the 'Tools' menu.
    • Click on 'Internet Options'.
    • Click on the 'Advanced' tab.
    • Put a check on print background color and images.
    0 讨论(0)
  • 2020-11-27 19:13

    You could have an own media-query for print and use :before selector with the attribute "content".

    Put this in the media query and it will insert the image when you try to print:

    p:before { content: url(images/quote.gif); }
    

    http://www.htmldog.com/reference/cssproperties/content/

    0 讨论(0)
提交回复
热议问题