html - 在 IE 和 Firefox 中打印预览图像周围的白色边框

标签 html css print-css

Firefox 和 IE 在进行打印预览时显示图像周围的边框。这是一个简单的页面,有两个 div,每个 div 包含一个图像宽度为 400px,容器 div 为 800px。我不希望在打印预览时得到的两个图像之间有白色边框。我在这里做错了什么吗? (在 chrome 中它不显示白色边框。)

我也为打印 css 尝试过这段代码,但没有成功..

<style type="text/css" media="print">
.test{float:none;display:inline;  border:none;}
img{border:0;}
</style>

代码是:

<!DOCTYPE html>
<html>
<head>
<style type="text/css" media="print">
.test{float:left; display:inline; border:none;}
</style>
</head>

 <body>
 <div style="width:800px;margin:0px auto;">
 <div class="test" style="float:left;width:400px;">
 <img src="1334300111712.jpg">
 </div>
 <div class="test" style="float:left;width:400px;">
<img src="1334300115318.jpg">
 </div>
  </div>
</body>

</html>

enter image description here

最佳答案

尝试添加这个 CSS:

img { border: 0; }

关于html - 在 IE 和 Firefox 中打印预览图像周围的白色边框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12844055/

相关文章:

python - 如何在 Bootstrap 轮播中使用 for 循环

html - 如何使用 CSS 为具有透明背景的白色图像着色?

html - 在每页打印上显示表头

html - 在打印 View 中无法获取我的自定义 CSS (ctrl + p)

html - 将绝对定位的 div 居中

html - IE9 不识别边界半径

html - Twitter-Bootstrap : Content is overlapping sticky-footer

javascript - HTML Canvas : Animation Delay

jquery - 菜单悬停,页面透明度变为0.5

html - 谷歌浏览器在不同的计算机上处​​理分页符的方式不同