在文本附近的白色边界包括背景颜色(White border around text covers background color)

编程入门 行业动态 更新时间:2024-10-28 19:20:39
在文本附近的白色边界包括背景颜色(White border around text covers background color)

我正在处理一组需要打印的HTML报告。 屏幕上的一切看起来都很正常,但打印页面时,所有文本元素周围都有一个白框。

这是屏幕上页面的屏幕截图: 屏幕上的屏幕截图http://oi41.tinypic.com/345onf4.jpg

以下是使用系统打印对话框打印的PDF的屏幕截图: 使用系统打印对话框http://oi43.tinypic.com/2vvmc9c.jpg打印的PDF的屏幕截图

这是HTML:

<!DOCTYPE html> <html> <head> <link rel="Stylesheet" type="text/css" href="../css/style.css" media="all"/> </head> <body> <div id="container"> <div id="menu"> <b>Menu</b><br> HTML<br> CSS<br> JavaScript</div> <div id="content"> Content goes here</div> </body> </html>

这是CSS:

@media print { /* Hides elements on page when printed */ .nonPrinting { display: none; } /* Forces the background colors / images to display when printing */ body { -webkit-print-color-adjust : exact; } } #container { width:500px; } #menu { background-color:#FFD700; height:200px; width:100px; float:left; } #content { background-color:#EEEEEE; height:200px; width:400px; float:left; }

页面在node-webkit应用程序内运行。

I am working on a set of HTML reports that need to be printed. Everything looks OK on the screen, but a white box surrounds all of the text elements when the page is printed.

Here is a screen shot of the page on screen: screen shot of the page on screen http://oi41.tinypic.com/345onf4.jpg

Here is a screen shot of a PDF printed using the system print dialog: screen shot of a PDF printed using the system print dialog http://oi43.tinypic.com/2vvmc9c.jpg

Here's the HTML:

<!DOCTYPE html> <html> <head> <link rel="Stylesheet" type="text/css" href="../css/style.css" media="all"/> </head> <body> <div id="container"> <div id="menu"> <b>Menu</b><br> HTML<br> CSS<br> JavaScript</div> <div id="content"> Content goes here</div> </body> </html>

Here is the CSS:

@media print { /* Hides elements on page when printed */ .nonPrinting { display: none; } /* Forces the background colors / images to display when printing */ body { -webkit-print-color-adjust : exact; } } #container { width:500px; } #menu { background-color:#FFD700; height:200px; width:100px; float:left; } #content { background-color:#EEEEEE; height:200px; width:400px; float:left; }

The pages are running inside of a node-webkit application.

最满意答案

您是否尝试在这些元素上指定特定的背景颜色?

尝试

background-color : transparent;

要么

background-color: #FFD700;

关于#menu的子元素

编辑

这就是'print'pdf对我来说的样子:

pdf在我的电脑上

编辑:

也许这是一个驱动程序问题?

Have you tried assigning a specific background-color on these elements?

Try

background-color : transparent;

or

background-color: #FFD700;

on the child elements of #menu

EDIT

This is how the 'printed' pdf looks like for me:

pdf at my computer

EDIT:

Maybe it's a driver issue?

更多推荐

本文发布于:2023-07-29 21:03:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1319741.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:边界   文本   白色   颜色   背景

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!