应用程序脚本html服务空白在顶部

时间:2013-03-07 17:18:39

标签: css google-apps-script

我有一个显示html文件的简单脚本

function doGet(e) {
     return HtmlService.createTemplateFromFile('Final Contract Agreement').evaluate();
}

和corrasponing html:

 <html>
   <head>
     <style type="text/css">
     #content{
          padding :0 0;
          margin : 0 auto;
          width: 800px;
          height : 600px;
          background: #FFFFFF;
     }
     body{
         background: #dbdad4;
         margin : 0;
     }
     #header{
         width: 100%;
         height: 82px;
         background: #4F2170;
         background-repeat:no-repeat;
     }
     #header h1{
         vertical-align:middle;
         text-align:right;
         color: white;
         padding-right: 50px;
     }
     </style>
 </head>
 <body>
    <div id="header">
      <h1>
         Contract Form
      </h1>
     </div>
    <div id="content">
       <h3>
        Hello World! 
        <?= new Date() ?>
      </h3>
    </div>
  </body>
 </html>

它输出了这个:

whitespace

我已尝试在元素上设置边距/填充的所有组合,但没有任何东西摆脱顶部的空白。当我在jane html文件中放入相同的代码时,它工作得很好。

1 个答案:

答案 0 :(得分:1)

我猜测caja是将空白添加到顶部,这个css为我删除了空白:

  * {
    margin: 0;
  }

对于那些想知道这是我如何让它占据整个浏览器窗口的人:

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