工藤新一用日语怎么说html打印预览页⾯背景,HTML–⽆法打印背景颜⾊(CSS解决
英译汉翻译
⽅案)?
好吧,我认为你没有得到我在评论中的意思,反正,所以它很简单,⽐如我有⼀个元素,⽐如说
背景设置为番茄,所以为了使这项⼯作,⾸先你必须确保你有媒体打印设置,如
@media print {
/* Declarations go here */
爱屋及乌英语
}
要么
现在,你需要宣布的是
-webkit-print-color-adjust:exact;在物业区,像
@media print, screen { /* Using for the screen as well */
.
blow {
height: 100px;
广州mba辅导班>翌日是什么意思width: 100px;
background: tomato;
-webkit-print-color-adjust: exact;
}
}
Demo(仅适⽤于webkit浏览器,即Chrome / Safari)
在上⾯的演⽰中,您甚⾄可以在Chrome的打印预览窗⼝中看到红⾊块.
正如你评论的那样,它对我有⽤..
要么
⽀持相同的是脏的,有关该属性的更多信息,您可以参考MDN
From MDN :
Body element backgrounds are not printed
Currently neither
会计应聘
failuresChrome nor Safari print backgrounds of the body element. If this
property is t to exact for the body element, it will apply only to
its descendants.老友记剧本
绿尾虹雉Chrome clipped image bug
When background images are clipped (for example, when using
background-image sprites), due to 07002, they will
appear distorted when printed from the Chrome browr with
-
webkit-print-color-adjust: exact. Solid backgrounds and background images that are not clipped (i.e. have lower width and height than the
element to which they are applied) are printed correctly.
External linksoffduty
WebKit bug 07003: “WIP: Add CSS property to control printing of backgrounds for individual elements” CSSWG wiki:“07004” – a proposal to standardize this property