2017-09-04 45 views
0

是否可以在打印中显示盒子阴影?如何在打印中显示箱影?

我在布局中使用框阴影而不是边框​​。 现在我想打印它,但盒子的阴影不会出现在印刷品中。

我该如何解决这个问题?

box-shadow: 0 0 0 1px black inset !important; 

这是我正尝试打印:
http://jsfiddle.net/Tx4Uv/177/

编辑

从来就尝试过这种没有任何成功:

-webkit-print-color-adjust:exact; 
-webkit-filter:opacity(1); 
+0

我相信你需要在打印机配置中打开它。您允许或不打印背景的地方。只有用户才能访问这个。 –

回答

-2

希望这个代码将帮助你

<!DOCTYPE html> 
 
<html> 
 
<head> 
 
<style> 
 
div { 
 
    width: 300px; 
 
    height: 100px; 
 
    padding: 15px; 
 
    background-color: yellow; 
 
    box-shadow: 10px 10px grey; 
 
} 
 
</style> 
 
</head> 
 
<body> 
 

 
<div>This is a div element with a box-shadow</div> 
 

 
</body> 
 
</html>

+0

试着打印这个,你会看到它不工作! –

0

好像它仅适用于Chrome与支持:

-webkit-print-color-adjust:exact; 

developer.mozilla.org

尝试创建一个媒体类型的打印的CSS:

<link rel="stylesheet" type="text/css" media="print" href="print.css" /> 

CSS Design: Going to Print

希望它对你有所帮助。