container {
height: 300px;
width: 500px;
margin: auto;
overflow: auto;
}
table {
border-collapse: collapse;
width: 100%;
}
thead th {
position: sticky;
top: 0;
background: white;
}
th, td {
border: 1px solid black;
}

Заголовок1 Заголовок2 Заголовок3 Заголовок4
abc defghijklmnopqrs tuv wxyz
abc defghijklmnopqrs tuv wxyz
abc defghijklmnopqrs tuv wxyz
abc defghijklmnopqrs tuv wxyz
abc defghijklmnopqrs tuv wxyz
abc defghijklmnopqrs tuv wxyz
abc defghijklmnopqrs tuv wxyz
abc defghijklmnopqrs tuv wxyz
abc defghijklmnopqrs tuv wxyz
abc defghijklmnopqrs tuv wxyz
abc defghijklmnopqrs tuv wxyz
abc defghijklmnopqrs tuv wxyz
abc defghijklmnopqrs tuv wxyz
abc defghijklmnopqrs tuv wxyz
abc defghijklmnopqrs tuv wxyz
abc defghijklmnopqrs tuv wxyz
abc defghijklmnopqrs tuv wxyz
abc defghijklmnopqrs tuv wxyz
abc defghijklmnopqrs tuv wxyz
abc defghijklmnopqrs tuv wxyz
abc defghijklmnopqrs tuv wxyz
abc defghijklmnopqrs tuv wxyz