Bonjour,
j'ai réalisé un scrolling sur un tableau tout en gardant l'entête fixe.
La largeur du tableau est égale à 100%, quelques colonnes ont une largeur fixe, les autres vont prendre le reste du 100%.
Je veux que les entêtes (TH) prennent toute la largeur du tableau, et que les colonnes (TD) respecte la largeur des entêtes (TH).
Merci à vous.

Voici le code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
 
<style>
#outer {
	padding-top:60px;
	width:100%;
	position:relative;
}
#inner {
	height:100px;
	overflow-x:hidden;
	overflow-y:auto;
	width:100%;
}
table{
	width:100%;
}
table thead {
	position:absolute;
	top:0;
	width:100%;
}
</style>
<div id="outer">
	<div id="inner">
		<table border="1">
			<thead>
				<tr>
					<th width="200">posuere urna</th>
					<th width="200">posuere urna</th>
					<th>posuere urna</th>
					<th>posuere urna</th>
					<th>posuere urna</th>
				</tr>
				<tr>
					<th>posuere urna</th>
					<th>posuere urna</th>
					<th>posuere urna</th>
					<th>posuere urna</th>
					<th>posuere urna</th>
				</tr>
			</thead>
			<tbody>
				<tr>
					<td>posuere urna</td>
					<td>posuere urna</td>
					<td>posuere urna</td>
					<td>posuere urna</td>
					<td>posuere urna</td>
				</tr>
				<tr>
					<td>posuere urna</td>
					<td>posuere urna</td>
					<td>posuere urna</td>
					<td>posuere urna</td>
					<td>posuere urna</td>
				</tr>
				<tr>
					<td>posuere urna</td>
					<td>posuere urna</td>
					<td>posuere urna</td>
					<td>posuere urna</td>
					<td>posuere urna</td>
				</tr>
				<tr>
					<td>posuere urna</td>
					<td>posuere urna</td>
					<td>posuere urna</td>
					<td>posuere urna</td>
					<td>posuere urna</td>
				</tr>
				<tr>
					<td>posuere urna</td>
					<td>posuere urna</td>
					<td>posuere urna</td>
					<td>posuere urna</td>
					<td>posuere urna</td>
				</tr>
				<tr>
					<td>posuere urna</td>
					<td>posuere urna</td>
					<td>posuere urna</td>
					<td>posuere urna</td>
					<td>posuere urna</td>
				</tr>
				<tr>
					<td>posuere urna</td>
					<td>posuere urna</td>
					<td>posuere urna</td>
					<td>posuere urna</td>
					<td>posuere urna</td>
				</tr>
			</tbody>
		</table>
	</div>
</div>