Я добавил корректировку высоты и ширины в табличный тег и установил для свойства overflow-x
и overflow-y
значение 'auto', но, похоже, что они не работают и таблица переполняется. Я попытался это реализовать, но это не работает в моем коде. Если в коде есть какая-то ошибка или что-то отсутствует, помогите мне решить эту проблему.
<style>
table {
max-width: 600px;
max-height: 400px;
border-spacing: 0;
display: block;
}
tbody {
overflow-y: auto;
overflow-x: auto;
}
th {
/*display: block;*/
border: 1px solid #293033;
position: sticky;
top: 0;
text-align: center;
padding: 8px;
color: #e9ecef;
background-color: #1e2324;
font-weight: 500;
font-size: 14px;
}
td {
background-color: #041230;
border: 1px solid #293033;
text-align: center;
padding: 8px;
color: #e9ecef;
min-width: 150px;
font-size: 13px;
word-spacing: 2px;
}
td:nth-child(1) {
min-width: 50px;
max-width: 50px;
font-weight: bold;
color: #66FCF1;
}
</style>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.11.2/css/all.min.css">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="resCSS.css">
<script src="https://rawgit.com/kimmobrunfeldt/progressbar.js/1.0.0/dist/progressbar.js"></script>
<script src="https://cdn.fancygrid.com/fancy.min.js"></script>
<div class="container">
<table class="tablecolor2">
<!-- class="tablecolor" -->
<thead>
<tr>
<th>#</th>
<th>Dummy</th>
<th>dvfdgdg</th>
<th>fvfdgfd/fdgdg</th>
<th>Cdumm</th>
<th>sdfdgds</th>
<th>Cd</th>
<th>Ankjfdksf</th>
<th>jnknk</th>
<th>fdfdgdfg</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>cdfdfsdfs</td>
<td> ssdfsf dfdsgsdgsdg typesetter in the 15th century who is thought to have scrambledon </td>
<td>ILorem ipsum, or lipsum as it is sometimes </td>
<td>known, is </td>
<td>dummy text used in laying out print, </td>
<td>N/A</td>
<td>graphic or web </td>
<td>N/A</td>
<td>designs. The passage is attributed to an unknown </td>
</tr>
<tr>
<td>1</td>
<td>cdfdfsdfs</td>
<td> ssdfsf dfdsgsdgsdg typesetter in the 15th century who is thought to have scrambledon </td>
<td>ILorem ipsum, or lipsum as it is sometimes </td>
<td>known, is </td>
<td>dummy text used in laying out print, </td>
<td>N/A</td>
<td>graphic or web </td>
<td>N/A</td>
<td>designs. The passage is attributed to an unknown </td>
</tr>
<tr>
<td>1</td>
<td>cdfdfsdfs</td>
<td> ssdfsf dfdsgsdgsdg typesetter in the 15th century who is thought to have scrambledon </td>
<td>ILorem ipsum, or lipsum as it is sometimes </td>
<td>known, is </td>
<td>dummy text used in laying out print, </td>
<td>N/A</td>
<td>graphic or web </td>
<td>N/A</td>
<td>designs. The passage is attributed to an unknown </td>
</tr>
<tr>
<td>1</td>
<td>cdfdfsdfs</td>
<td> ssdfsf dfdsgsdgsdg typesetter in the 15th century who is thought to have scrambledon </td>
<td>ILorem ipsum, or lipsum as it is sometimes </td>
<td>known, is </td>
<td>dummy text used in laying out print, </td>
<td>N/A</td>
<td>graphic or web </td>
<td>N/A</td>
<td>designs. The passage is attributed to an unknown </td>
</tr>
<tr>
<td>1</td>
<td>cdfdfsdfs</td>
<td> ssdfsf dfdsgsdgsdg typesetter in the 15th century who is thought to have scrambledon </td>
<td>ILorem ipsum, or lipsum as it is sometimes </td>
<td>known, is </td>
<td>dummy text used in laying out print, </td>
<td>N/A</td>
<td>graphic or web </td>
<td>N/A</td>
<td>designs. The passage is attributed to an unknown </td>
</tr>
<tr>
<td>1</td>
<td>cdfdfsdfs</td>
<td> ssdfsf dfdsgsdgsdg typesetter in the 15th century who is thought to have scrambledon </td>
<td>ILorem ipsum, or lipsum as it is sometimes </td>
<td>known, is </td>
<td>dummy text used in laying out print, </td>
<td>N/A</td>
<td>graphic or web </td>
<td>N/A</td>
<td>designs. The passage is attributed to an unknown </td>
</tr>
<tr>
<td>1</td>
<td>cdfdfsdfs</td>
<td> ssdfsf dfdsgsdgsdg typesetter in the 15th century who is thought to have scrambledon </td>
<td>ILorem ipsum, or lipsum as it is sometimes </td>
<td>known, is </td>
<td>dummy text used in laying out print, </td>
<td>N/A</td>
<td>graphic or web </td>
<td>N/A</td>
<td>designs. The passage is attributed to an unknown </td>
</tr>
<tr>
<td>1</td>
<td>cdfdfsdfs</td>
<td> ssdfsf dfdsgsdgsdg typesetter in the 15th century who is thought to have scrambledon </td>
<td>ILorem ipsum, or lipsum as it is sometimes </td>
<td>known, is </td>
<td>dummy text used in laying out print, </td>
<td>N/A</td>
<td>graphic or web </td>
<td>N/A</td>
<td>designs. The passage is attributed to an unknown </td>
</tr>
<tr>
<td>1</td>
<td>cdfdfsdfs</td>
<td> ssdfsf dfdsgsdgsdg typesetter in the 15th century who is thought to have scrambledon </td>
<td>ILorem ipsum, or lipsum as it is sometimes </td>
<td>known, is </td>
<td>dummy text used in laying out print, </td>
<td>N/A</td>
<td>graphic or web </td>
<td>N/A</td>
<td>designs. The passage is attributed to an unknown </td>
</tr>
<tr>
<td>1</td>
<td>cdfdfsdfs</td>
<td> ssdfsf dfdsgsdgsdg typesetter in the 15th century who is thought to have scrambledon </td>
<td>ILorem ipsum, or lipsum as it is sometimes </td>
<td>known, is </td>
<td>dummy text used in laying out print, </td>
<td>N/A</td>
<td>graphic or web </td>
<td>N/A</td>
<td>designs. The passage is attributed to an unknown </td>
</tr>
<tr>
<td>1</td>
<td>cdfdfsdfs</td>
<td> ssdfsf dfdsgsdgsdg typesetter in the 15th century who is thought to have scrambledon </td>
<td>ILorem ipsum, or lipsum as it is sometimes </td>
<td>known, is </td>
<td>dummy text used in laying out print, </td>
<td>N/A</td>
<td>graphic or web </td>
<td>N/A</td>
<td>designs. The passage is attributed to an unknown </td>
</tr>
<tr>
<td>1</td>
<td>cdfdfsdfs</td>
<td> ssdfsf dfdsgsdgsdg typesetter in the 15th century who is thought to have scrambledon </td>
<td>ILorem ipsum, or lipsum as it is sometimes </td>
<td>known, is </td>
<td>dummy text used in laying out print, </td>
<td>N/A</td>
<td>graphic or web </td>
<td>N/A</td>
<td>designs. The passage is attributed to an unknown </td>
</tr>
<tr>
<td>1</td>
<td>cdfdfsdfs</td>
<td> ssdfsf dfdsgsdgsdg typesetter in the 15th century who is thought to have scrambledon </td>
<td>ILorem ipsum, or lipsum as it is sometimes </td>
<td>known, is </td>
<td>dummy text used in laying out print, </td>
<td>N/A</td>
<td>graphic or web </td>
<td>N/A</td>
<td>designs. The passage is attributed to an unknown </td>
</tr>
</tbody>
</table>
</div>
![Image 2 table layout](https://i.stack.imgur.com/mUExR.png)