Here's a simple table code.
Here's is the jsfiddle code for it - JSFiddle Link
The thing is that when the head
gets a position : fixed
it simply lose all the properties of the table-
such as the whole width, each cell width.
So the thing I would be happy to know is if there's any way to fix it?
Thanks for any kind of help
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<style>
table {
width: 100%;
}
th td {
width:25%;
}
thead {
background-color: #f00;
position: fixed;
}
</style>
</head>
<body>
<table>
<thead>
<tr>
<th>1</th>
<th>2</th>
<th>3</th>
<th>4</th>
</tr>
</thead>
<tbody>
<tr>
<td>A</td>
<td>B</td>
<td>C</td>
<td>D</td>
</tr>
<tr>
<td>A</td>
<td>B</td>
<td>C</td>
<td>D</td>
</tr>
<tr>
<td>A</td>
<td>B</td>
<td>C</td>
<td>D</td>
</tr>
<tr>
<td>A</td>
<td>B</td>
<td>C</td>
<td>D</td>
</tr>
<tr>
<td>A</td>
<td>B</td>
<td>C</td>
<td>D</td>
</tr>
<tr>
<td>A</td>
<td>B</td>
<td>C</td>
<td>D</td>
</tr>
<tr>
<td>A</td>
<td>B</td>
<td>C</td>
<td>D</td>
</tr>
<tr>
<td>A</td>
<td>B</td>
<td>C</td>
<td>D</td>
</tr>
</tbody>
</table>
</body>
</html>