How to get a background image to print using css?

后端 未结 10 696
再見小時候
再見小時候 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 18:55

    It is working in Google Chrome when you add the !important attribute to the background image. Make sure you add the attribute first and then try again, you can do it like this:

    .class-name {
    background: url('your-image.png') !important;
    }
    

    Also you can use these useful printing rules and put them at the end of css file:

    @media print {
    * {
        -webkit-print-color-adjust: exact !important; /*Chrome, Safari */
        color-adjust: exact !important;  /*Firefox*/
      }
    }
    

提交回复
热议问题