第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

保持固定標(biāo)題的水平滾動位置與正文同步

保持固定標(biāo)題的水平滾動位置與正文同步

三國紛爭 2023-07-06 19:49:38
所以我有一個網(wǎng)頁,本質(zhì)上是一個表格視圖。表格的主體可以水平和垂直滾動,但標(biāo)題應(yīng)始終保持在頂部并且僅水平滾動(以匹配主體的位置)。我當(dāng)前的解決方案是將標(biāo)題和正文保留在單獨的div中,標(biāo)題具有overflow-x:auto和overflow-y:隱藏,正文具有overflow:auto。然后我有 JS 代碼來監(jiān)視“滾動”事件,這樣我就可以以編程方式更新水平滾動位置。它可以工作,但它很丑陋,有時會有一點延遲,滾動正文后標(biāo)題不會立即更新位置。我查看了類似問題的答案,但沒有找到更好的答案來解決水平滾動問題。我對任何框架或第三方解決方案都不感興趣。謝謝!如何讓桌子的主體滾動但保持其頭部固定在適當(dāng)?shù)奈恢茫?
查看完整描述

1 回答

?
慕標(biāo)琳琳

TA貢獻(xiàn)1830條經(jīng)驗 獲得超9個贊

非常簡單:

<th>的樣式設(shè)置為sticky,

top: 0粘在頂部,并

background-color: white“隱藏”滾動行。


nowrap用于水平效果(非必需)。


th {

  position: sticky;

  top: 0;

  background-color: white;

}

<table border="1">

  <tr>

    <th>sticky blah blah blah sticky </th>

    <th>sticky blah blah blah sticky </th>

    <th>sticky blah blah blah sticky </th>

    <th>sticky blah blah blah sticky </th>

    <th>sticky blah blah blah sticky </th>

    <th>sticky blah blah blah sticky </th>

    <th>sticky blah blah blah sticky </th>

    <th>sticky blah blah blah sticky </th>

    <th>sticky blah blah blah sticky </th>

  </tr>

  <tr>

    <td nowrap>normal blah blah blah normal 01</td>

    <td nowrap>normal blah blah blah normal </td>

    <td nowrap>normal blah blah blah normal </td>

    <td nowrap>normal blah blah blah normal </td>

    <td nowrap>normal blah blah blah normal </td>

    <td nowrap>normal blah blah blah normal </td>

    <td nowrap>normal blah blah blah normal </td>

    <td nowrap>normal blah blah blah normal </td>

    <td nowrap>normal blah blah blah normal </td>

  </tr>

  <tr>

    <td>normal blah blah blah normal 02</td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

  </tr>

  <tr>

    <td>normal blah blah blah normal 03</td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

  </tr>

  <tr>

    <td>normal blah blah blah normal 04</td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

  </tr>

  <tr>

    <td>normal blah blah blah normal 05</td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

  </tr>

  <tr>

    <td>normal blah blah blah normal 06</td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

  </tr>

  <tr>

    <td>normal blah blah blah normal 07</td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

  </tr>

  <tr>

    <td>normal blah blah blah normal 08</td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

  </tr>

  <tr>

    <td>normal blah blah blah normal 09</td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

  </tr>

  <tr>

    <td>normal blah blah blah normal 10</td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

  </tr>

  <tr>

    <td>normal blah blah blah normal 11</td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

  </tr>

  <tr>

    <td>normal blah blah blah normal 12</td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

  </tr>

  <tr>

    <td>normal blah blah blah normal 13</td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

  </tr>

  <tr>

    <td>normal blah blah blah normal 14</td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

  </tr>

  <tr>

    <td>normal blah blah blah normal 15</td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

  </tr>

  <tr>

    <td>normal blah blah blah normal 16</td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

  </tr>

  <tr>

    <td>normal blah blah blah normal 17</td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

  </tr>

  <tr>

    <td>normal blah blah blah normal 18</td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

  </tr>

  <tr>

    <td>normal blah blah blah normal 19</td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

  </tr>

  <tr>

    <td>normal blah blah blah normal 20</td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

  </tr>

  <tr>

    <td>normal blah blah blah normal 21</td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

  </tr>

  <tr>

    <td>normal blah blah blah normal 22</td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

  </tr>

  <tr>

    <td>normal blah blah blah normal 23</td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

  </tr>

  <tr>

    <td>normal blah blah blah normal 24</td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

  </tr>

  <tr>

    <td>normal blah blah blah normal 25</td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

  </tr>

  <tr>

    <td>normal blah blah blah normal 26</td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

  </tr>

  <tr>

    <td>normal blah blah blah normal 27</td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

  </tr>

  <tr>

    <td>normal blah blah blah normal 28</td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

  </tr>

  <tr>

    <td>normal blah blah blah normal 29</td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

  </tr>

  <tr>

    <td>normal blah blah blah normal 30</td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

  </tr>

  <tr>

    <td>normal blah blah blah normal 31</td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

  </tr>

  <tr>

    <td>normal blah blah blah normal 32</td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

  </tr>

  <tr>

    <td>normal blah blah blah normal 33</td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

  </tr>

  <tr>

    <td>normal blah blah blah normal 34</td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

  </tr>

  <tr>

    <td>normal blah blah blah normal 35</td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

  </tr>

  <tr>

    <td>normal blah blah blah normal 36</td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

  </tr>

  <tr>

    <td>normal blah blah blah normal 37</td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

  </tr>

  <tr>

    <td>normal blah blah blah normal 38</td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

  </tr>

  <tr>

    <td>normal blah blah blah normal 39</td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

  </tr>

  <tr>

    <td>normal blah blah blah normal 40</td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

    <td>normal blah blah blah normal </td>

  </tr>

</table>


查看完整回答
反對 回復(fù) 2023-07-06
  • 1 回答
  • 0 關(guān)注
  • 151 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號