我想为每个打印页面写一个div。所以我做了div的高度100%。通常,在每种浏览器中,它都能正常运行。但是,当我打印此页面时,它无法在Chrome中运行。

<!DOCTYPE HTL>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="robots" content="noindex, nofollow">
<meta name="googlebot" content="noindex">
<meta http-equiv="cache-control" content="no-cache">
<title>Brove.NET ISO Yazılımı</title>
<style>
html,body{
    padding:0;
    margin:0;
    height:100%;
    width:100%;
}
.sayfa{
    height: 100%;
    width: 768px;
}
</style>
</head>

<body>
<div class="sayfa" style="background-color:#666666">fds</div>
<div class="sayfa" style="background-color:#cccccc">fds</div>
<div class="sayfa" style="background-color:#aaaaaa">fds</div>


<script type="text/javascript" src="js/jquery-1.5.2.min.js"></script>
</body>
</html>

最佳答案

这是解决方案,伙计...

试试下面的代码

@media print and (-webkit-min-device-pixel-ratio:0) {
.sayfa{
    height: 1101px;
    width: 768px;
}
}

关于html - 当我打印时100%高度的div在Chrome中不起作用,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/8835420/

10-13 08:41
查看更多