div{

 overflow:auto;

 width:100%;

 height:100%; /* 固定高度 */

}

td, th {

 border:1px solid gray;

 width:auto;

 height:30px;

}

th {

 background-color:lightblue;

}
body {
            font-size: calc(1em + 0.5vw);
        }

table {

 table-layout: auto;

 width: 100%; /* 固定寬度 */
 border-collapse: collapse;
 font-size: inherit;

}
td:first-child, th:first-child {

 position:sticky;

 left:0; /* 首行永遠固定於左 */

 z-index:1;

 background-color:lightpink;
 font-size: inherit;

}

thead tr th {

 position:sticky;

 top:0; /* 列首永遠固定於上 */
 font-size: inherit;

}

th:first-child{

 z-index:2;

 background-color:lightblue;
 font-size: inherit;

}