开发者

Print background image in IE without enable "Print background colors and images"

开发者 https://www.devze.com 2023-01-06 19:35 出处:网络
Is possible to print a background-image whithout enabling \"Print Backgr开发者_如何学运维ound colors and images\" in Advanced tab of Internet Options ?

Is possible to print a background-image whithout enabling "Print Backgr开发者_如何学运维ound colors and images" in Advanced tab of Internet Options ?

I think to use a alternative way without "background-image"... Using div tag and position absolute is possible to emulate the same effect of background-image? Also I would like to repeat the background image through the page.


The ability to print background images (those images specified as background-images in the markup) is entirely up to the end user, you can not control this programmatically from your code. There is a plugin for Firefox that provides a JavaScript API to control many print settings - this might be able to control background-images. However, this obviously only works in Firefox and is dependent on the end user having this particular plugin installed.

You could use absolutely positioned IMG tags and manage the z-index of layered containers to push the IMG to the back, but TBH it's starting to get messy and you may not be able to achieve the affect you are after and maintain correct semantic markup. Certainly if you want the IMG to repeat you'd have to resort to JavaScript to create and position multiple IMG tags, or create one large image that you have manually tiled - not recommended.

Unless you have a specific requirement, users generally do not want (or need) background images to be printed - hence the easy reach option in the browser. So it may be best to rethink the problem. Print and screen are two very different media so you shouldn't necessarily try to mimic on screen display in print, hence CSS's ability to create print only stylesheets - if that is what you are trying to achieve?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号