我有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