在进行CSS打印时,身体部位正在Header区域内

时间:2017-03-16 05:06:50

标签: javascript html css printing print-css

当进行打印时,正文内容位于标题区域下方。

我写了1-9号码没有显示号码只显示号码从5开始我认为问题是我们正在添加位置是固定的如果我们不使用位置固定页眉和页脚将不会显示所有页面



    body {
        background: #eaeaed;
        -webkit-print-color-adjust: exact;
    }
    .my-footer{
        background: #2db34a;
        bottom: 0;
        left: 0;
        position: fixed;
        right: 0;
        height: 80px;
    }
    .my-header {
        background: red;
        top: 0;
        left: 0;
        position: fixed;
        right: 0;
        height: 100px;
        padding-bottom: 10px;
    }

<html>
    <head>
        <meta charset=utf-8 />
        <title>Header & Footer</title>
 
    </head> 
    <body>
        <div>
            <div class="my-header">Fixed Header</div>
            <div class="my-footer">Fixed Footer</div>
            <table>
                <thead>
                    <tr><th>TH 1</th><th>TH 2</th></tr>
                </thead>
                <tbody>
                    <tr><td>1</td><td>1</td></tr>
                    <tr><td>2</td><td>2</td></tr>
                    <tr><td>3</td><td>3</td></tr>
                    <tr><td>4</td><td>4</td></tr>
                    <tr><td>5</td><td>5</td></tr>
                    <tr><td>6</td><td>6</td></tr>
                    <tr><td>7</td><td>7</td></tr>
                    <tr><td>8</td><td>8</td></tr>
                    <tr><td>9</td><td>9</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                    <tr><td>TD 1</td><td>TD 2</td></tr>
                </tbody>
            </table>
        </div>
    </body>
</html>
&#13;
&#13;
&#13;

&#13;
&#13;
 body {
        background: #eaeaed;
        -webkit-print-color-adjust: exact;
        margin-top:100px;
        margin-bottom:100px;
    }
    .my-footer{
        background: #2db34a;
        bottom: 0;
        left: 0;
        position: fixed;
        right: 0;
        height: 80px;
    }
    .my-header {
        background: red;
        top: 0;
        left: 0;
        position: fixed;
        right: 0;
        height: 100px;
        padding-bottom: 10px;
     }
</style> 
&#13;
<html>

<head>
  <meta charset=utf-8 />
  <title>Header & Footer</title>
  
</head>

<body>
  <div class="container">
    <div class="my-header">Fixed Header</div>
    <div class="my-footer">Fixed Footer</div>
    <table>
      <thead>
        <tr>
          <th>TH 1</th>
          <th>TH 2</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td>1</td>
          <td>1</td>
        </tr>
        <tr>
          <td>2</td>
          <td>2</td>
        </tr>
        <tr>
          <td>3</td>
          <td>3</td>
        </tr>
        <tr>
          <td>4</td>
          <td>4</td>
        </tr>
        <tr>
          <td>5</td>
          <td>5</td>
        </tr>
        <tr>
          <td>6</td>
          <td>6</td>
        </tr>
        <tr>
          <td>7</td>
          <td>7</td>
        </tr>
        <tr>
          <td>8</td>
          <td>8</td>
        </tr>
        <tr>
          <td>9</td>
          <td>9</td>
        </tr>
        <tr>
          <td>10</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>11</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>12</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>13</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>14</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>15</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>16</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>17</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>18</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>19</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>20</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>21</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>22</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>23</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>24</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>25</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>26</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>27</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>28</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>29</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>30</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>31</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>32</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>33</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>34</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>35</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>36</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>37</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>38</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>39</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>40</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>41</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>42</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>43</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>44</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>45</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>46</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>47</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>48</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>49</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>50</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>51</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
        <tr>
          <td>TD 1</td>
          <td>TD 2</td>
        </tr>
 
      </tbody>
    </table>
  </div>
</body>

</html>
&#13;
&#13;
&#13;

2 个答案:

答案 0 :(得分:0)

页眉和页脚由浏览器创建。唯一可以改变这种情况的是最终用户。

在Mozilla中,https://bug743252.bugzilla.mozilla.org/attachment.cgi?id=714383(查看页面源标记HTML),我们可以选择将<html>替换为<html moznomarginboxes mozdisallowselectionprint>。页眉和页脚将被删除。但遗憾的是,在Firefox 48发布后(2016年8月),这也不再适用。

对于其他浏览器,请查看此网站http://www.mintprintables.com/print-tips/header-footer-windows/。这可以用作用户的帮助链接。

答案 1 :(得分:0)

试试这个!

 html,
     body {         
               height:   100%;
               min-height:   100%;
               background: #eaeaed;
               -webkit-print-color-adjust: exact;
               }
               .my-table
               {
                    position: absolute; 
                    top: 8%;
                    overflow: scroll;
                    height:83%;
                    width: 100%;
               }

               .my-footer
               {
                    background: #2db34a;
                    bottom: 0;
                    left: 0;
                    position: absolute;    ;
                    right: 0;
                    height: 8%;
               }
               .my-header 
               {
                    background: red;
                    top: 0;
                    left: 0;
                    position: absolute;    ;
                    right: 0;
                    height: 8%;
                    z-index:  9;
               }
          }
<html>
    <head>
        <meta charset=utf-8 />
        <title>Header & Footer</title>
 
    </head> 
    <body>
        <div style="height: 100%; position: relative; height:    100%;">
            <div class="my-header">Fixed Header</div>
            <div class="my-table">
               <table class="" style="">
                   <thead>
                       <tr><th>TH 1</th><th>TH 2</th></tr>
                   </thead>
                   <tbody>
                       <tr><td>1</td><td>1</td></tr>
                       <tr><td>2</td><td>2</td></tr>
                       <tr><td>3</td><td>3</td></tr>
                       <tr><td>4</td><td>4</td></tr>
                       <tr><td>5</td><td>5</td></tr>
                       <tr><td>6</td><td>6</td></tr>
                       <tr><td>7</td><td>7</td></tr>
                       <tr><td>8</td><td>8</td></tr>
                       <tr><td>9</td><td>9</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>TD 1</td><td>TD 2</td></tr>
                       <tr><td>End</td><td>End</td></tr>
                   </tbody>
               </table>
            </div>
            
            <div class="my-footer">Fixed Footer</div>
            
        </div>
    </body>
</html>