html 表格head頭部不動 body部分滾動,每格寬同內容增加


如下圖同Excel表格首行固定:

 

<style>
.table{    width: 100%;    border-collapse:collapse;    border-spacing:0;}

.table thead{display: block; width: 100%; background: #ddd;}
.table tbody
{display: block; height:70px; overflow: auto; width: 100%; border: 1px solid #ddd;}
.table td,.table th
{ width: 200px; border-bottom: none; border-left: none; border-right: 1px solid #CCC; border-top: 1px solid #DDD; padding: 2px 3px 3px 4px }
.table tr
{ border-bottom: 1px solid #B74; } </style>
<table class="table">
                <thead>
                <tr>
                    <th>header</th>
                    <th>header two</th>
                    <th>header two</th>
                    <th>header two</th>
                    <th>header two</th>
                    <th>header two</th>
                </tr>
                </thead>
                <tbody class="M_scrollBar">
                <tr>
                    <td>fuck 1</td>
                    <td>fuck 2</td>
                    <td>fuck 2</td>
                    <td>fuck 2</td>
                    <td>fuck 2</td>
                    <td>fuck 2</td>
                </tr>
                <tr>
                    <td>fuck 1</td>
                    <td>fuc<br>kfuc<br>kfuc<br>kfuc<br>kfuc<br>kfuc<br>kfuc<br>kfuc<br>kfuc<br>kfuc<br>kfuc<br>kfuc<br>kfuc<br>kfuc<br>k 2</td>
                    <td>fuck 2</td>
                    <td>fuck 2</td>
                    <td>fuck 2</td>
                    <td>fuck 2</td>
                </tr>
                <tr>
                    <td>fuck 1</td>
                    <td>fuck 2</td>
                    <td>fuck 2</td>
                    <td>fuck 2</td>
                    <td>fuck 2</td>
                    <td>fuck 2</td>
                </tr>
                <tr>
                    <td>fuck 1</td>
                    <td>fuck 2</td>
                    <td>fuck 2</td>
                    <td>fuck 2</td>
                    <td>fuck 2</td>
                    <td>fuck 2</td>
                </tr>
                </tbody>
            </table>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



猜您在找 表格表頭不動,內容自動向上滾動 CSS里使BODY的背景圖片固定不動內容滾動 HTML中head與body標簽 Html之head部分詳解 table中head表頭固定,body滾動 HTML頁面布局,右側菜單不動,左側內容溢出后可以操作滾動條 使用datatables實現列寬設置、水平滾動條、顯示某列部分內容 關於表格的一些練習

一個普通基本的表格

關於表格的一些練習

一個普通基本的表格

HTML表格和列表筆記&練習
 
粵ICP備18138465號   © 2018-2026 CODEPRJ.COM
vue-固定頭部-內容可滾動 HTML :包含了所有的頭部標簽元素