0

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

我写 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>

 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> 
<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>

4

2 回答 2

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>

于 2017-03-16T09:38:25.743 回答
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/。这可以用作用户的帮助链接。

于 2017-03-16T05:49:32.633 回答