我有HTML這樣的:頭在固定的地方
<article>
<header>
<hgroup>
<h1>Wk 25 </h1>
<h2>(18-06 tot 24-06)</h2>
</hgroup>
<p>Some info</p>
</header>
<table>
<thead>
<tr>
<th class="legenda">Title</th>
<th class="legenda">Title</th>
<th class="legenda">Title</th>
</tr>
</thead>
<tbody>
<tr>
<td>content</td>
<td>content</td>
<td>content</td>
</tr>
</tbody>
</table>
</article>
和CSS(節選)是這樣的:
article {
padding: 0;
margin-bottom: 15px;
overflow: auto;
}
article header {
background: url('header.png') repeat-x bottom center;
padding: 4px 10px;
cursor: pointer;
}
文章元素與瀏覽器窗口大小調整。裏面的表格可以寬於文章元素,因此overflow:auto。但是:標題元素的寬度爲100%,所以如果向右滾動,標題將變爲不可見。
如果我給頭的位置是:絕對的,我需要給它一個固定的高度太:不行,因爲有高度依賴於內容(變化)。
所以事情是,我希望它只是呈現象現在這樣,只是當我滾動到右側,頭保持可見。
Thx工作正常。並猜測額外的div並不是那麼糟糕。 – Lennart