固定位置のヘッダー(動的高さ)があります。htmlの位置固定ヘッダー
ヘッダーのすぐ下にコンテナdivを配置する必要があります。ヘッダーの高さは動的なので、固定値を上余白に使用することはできません。
どうすればいいですか?
ここに私のCSSです:
#header-wrap {
position: fixed;
height: auto;
width: 100%;
z-index: 100
}
#container{
/*Need to write css to start this div below the fixed header without mentioning top margin/paading*/
}
...とHTML:
<div id="header-wrap">
<div id="header">
<div id="menu">
<ul>
<li><a href="#" class="active">test 0</a></li>
<li><a href="#">Give Me <br />test</a></li>
<li><a href="#">My <br />test 2</a></li>
<li><a href="#">test 4</a></li>
</ul>
</div>
<div class="clear">
</div>
</div>
</div><!-- End of header -->
<div id="container">
</div>
固定ヘッダは、レイアウトの一部ではありません。それは浮いている。ヘッダーがあるかのように動作するように、コンテンツに「margin-top」を与える必要があります。 – Blender
これを読んでくださいhttp://css-tricks.com/absolute-relative-fixed-positioining-how-do-they-differ/ – sandeep
[固定ヘッダーを持つCSS専用のスクロール可能なテーブル]の可能な複製(http:// stackoverflow。 com/questions/11891065/css-only-scrollable-table-with-fixed-headers) –