English 中文(简体)
Chrome一印刷时100%的高射线
原标题:100% height div isnt working in Chrome when i print it
  • 时间:2012-01-12 12:55:34
  •  标签:
  • html
  • height

I want to write a div for every print page. So i did height of div 100%. Normally in every browser it is working well. But when i print this page it is not working in 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>
最佳回答

这就是解决办法,人......

Try this code that is

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

1. 将贵方的宽度和高度以及身体要素提高到100%:

<style>

html {
  width: 100%;
  height: 100%;
}

body {
  width: 100%;
  height: 100%;
}

</style>

我无法找到任何关于这一丑恶的文件,但毫无疑问,这只是一纸空洞。

你的法典将在非Webkit浏览器(如果假设Safari公司也做同样的事)中完美地实施,并在屏幕上显示罚款,然后变成在点击印刷时失败的魔mag吗? 怎么做呢?

Answer, give the HTML and BODY tags a defined height in an "actual" measurement, not percents:

html, body {
   margin: 0;
   padding: 0;
   /* etc */

   height: 880px;       
}

div.sayfa {
   height: 33%;
}

这些页面使用上述风格,将同一网页从14°到19+。

我的实验给我们使用的打印机带来了880个纸浆的高印页,你的里程可能有所不同。 技经评估组的工作也造成了太多的头痛,因此,我看上去的是肯定的六氯乙烯价值的最佳效果。

它是一件大事,但至少是实际工作。





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!