2012-01-17 48 views
3

我有一个从CSS精灵这样加载两个图像的网页:打印图像从css sprite加载?

<html> 
<head> 
    <link rel="stylesheet" type="text/css" href="stylesheet.css"> 
</head> 
<body> 
    <div class="arrow low"></div> 
    <div class="arrow high"></div> 
</body> 
</html> 

和CSS(stylesheet.css中)看起来是这样的:

.arrow 
{ 
    height: 239px; 
    width: 260px; 
    background: url('logotypearrows.png') no-repeat; 
} 

.arrow.high 
{ 
    background-position: 10px 0px; 
} 

.arrow.low 
{ 
    background-position: -1003px 0px; 
} 

的网页看起来很完美,但我无法打印它。我看不到动态加载的箭头。任何人都知道如何解决这个问题?我希望能够打印出箭头,并且我想从css精灵中加载它们。

回答

3

默认浏览器不打印背景图像,这可以由用户更改。 也许您应该在div <div class="arrow low"><span class="print-only">*</span></div>内部添加一些内容,并且仅使用@media print的网页的打印版本才能看到它。

0

在哪张图片您必须打印?

0

这取决于用户和他们的浏览器设置打印或不打印 背景图像。为了避免依赖于此,请将 图像放在HTML中的前景中。 - Kon

(从这个related thread拍摄)