简体   繁体   English

如何在打印时使div宽度和高度100%

[英]How to make div width and height 100% while printing

Hello I have a fullcalendar.js implemented on my page,but i cant print the calendar covering full page. 您好,我的页面上实现了fullcalendar.js,但是无法打印整个页面的日历。 Here is my html 这是我的html

<body>
  <table>
    <tr>
      <td width = 25% > hello </td>
      <td> <div id='calendar'></div></td>
   </tr>
</table> </body>

Now if I try to print this I m getting a blank space on left here is my style. 现在,如果我尝试打印此图像,那么我的左边就是空白。

<style>
    @media print {
    body * {
    visibility: hidden;
    }
    #calendar,
    #calendar * {
    visibility: visible;
    }

    }

So how to print just a div #calendar covering full page here is my implementation http://plnkr.co/edit/SsYdQn?p=preview 因此,如何在此处打印仅占整个页面的div #calendar是我的实现http://plnkr.co/edit/SsYdQn?p=preview

Try @page declaration. 尝试@page声明。

Add the following style rule to the page. 将以下样式规则添加到页面。 It removes all blank spaces on the all sides. 它将删除所有侧面的所有空格。

<style type='text/css'>
@page{margin:0;size:auto}
</style>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM