我有一个网页从这样的 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 sprite 加载它们。
最佳答案
默认情况下浏览器不打印背景图像,这可以由用户更改。
也许你应该在 div <div class="arrow low"><span class="print-only">*</span></div>
中添加一些内容并使用 @media print
使其仅对您页面的打印版本可见.
关于html - 打印从 css sprite 加载的图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8894737/