Printing background-color in Firefox and IE

前端 未结 5 1160
执念已碎
执念已碎 2020-12-29 05:27

I am with some problems to print background-color in Firefox and IE. For Google Chrome I found the follow hack and it works well, but for Firefox and IE I can\'t find anythi

5条回答
  •  星月不相逢
    2020-12-29 06:15

    If you are OK with having your element being a fixed height/width, you can set its size, put a 1px coloured image into it (of whatever colour you want the background to be) and make it fill the space. Then you can absolutely position your content on top.

    Hello world

    Or you could do the same thing with a border instead of an image:

    Hello world

    (Original idea from here: https://defuse.ca/force-print-background.htm)

提交回复
热议问题