frame で切られたページは最近様々な理由で敬遠されてきており、
替わって、CSS でレイアウトされたページがポピュラーになってきている。
しかし、IEとFirefoxなどでCSSの解釈が異なるために、
うまくレイアウトが効かず苦労すると。
その末たどり着いたレイアウトを、以下にメモ。
これなら、Firefox でも バカIE6 でも同じように表示される。
標準モードでも後方互換モードでもどちらでもOK。
ヘッダ、フッタ、コンテンツ のパターン †
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
|
| <style type="text/css">
html, body {
margin: 0; padding: 0;
}
html body {
padding-top: 77px;
padding-bottom: 45px;
overflow: hidden;
}
#contentsHeader {
position: absolute;
z-index: 1;
left: 0px;
top: 0px;
background-color: #ff8888;/* わかりやすくするため */
width:100%;
height: 77px;
}
#contentsBody {
position: relative;
overflow: auto;
z-index: 0;
width:100%;
height: 100%;
background-color: #88ff88;/* わかりやすくするため */
}
#contentsFooter {
position: absolute;
z-index: 1;
left: 0px;
bottom: 0px;
width: 100%;
height: 45px;
background-color: #8888ff;/* わかりやすくするため */
}
</style>
|
ヘッダやフッタの高さはお好みで調整可。
ヘッダ、フッタ、左コンテンツ、右コンテンツ のパターン †
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
|
| <style type="text/css">
html, body {
margin: 0; padding: 0;
}
html body {
padding-top: 77px;
padding-bottom: 45px;
overflow: hidden;
}
#contentsHeader {
position: absolute;
z-index: 1;
left: 0px;
top: 0px;
background-color: #ff8888;/* わかりやすくするため */
width:100%;
height: 77px;
}
#contentsBody {
position: relative;
overflow: auto;
z-index: 0;
width:100%;
height: 100%;
background-color: #88ff88;/* わかりやすくするため */
}
#contentsFooter {
position: absolute;
z-index: 1;
left: 0px;
bottom: 0px;
width: 100%;
height: 45px;
background-color: #8888ff;/* わかりやすくするため */
}
#contentsLeft {
position: absolute;
top: 0px;
left: 0px;
width: 120px;
height: 100%;
background-color: #ffcccc;/* わかりやすくするため */
}
#contentsRight {
position: absolute;
top: 0px;
left: 120px;
height: 100%;
background-color: #ccccff;/* わかりやすくするため */
}
</style>
|
上記のサンプル †
MLEXP. Wiki