teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

1

追記

2018/01/15 08:52

投稿

yambejp
yambejp

スコア117914

answer CHANGED
@@ -22,4 +22,37 @@
22
22
  <a href="#hoge2">2</a>
23
23
  <a href="#hoge3">3</a>
24
24
  </div>
25
+ ```
26
+
27
+ # 追記
28
+ もうちょっと突っ込んで、ようはheaderが固定でおいてあって
29
+ 本文が隠れるのがいやなんですよね?
30
+ ```CSS
31
+ body{padding:0px;margin:0px;}
32
+ #wrap{position:relative;}
33
+ #header{background-Color:gray;color:red;position:fixed;height:1.5em;width:100%;}
34
+ .hoge{height:1000px;padding-top:1.5em;}
35
+ #hoge1{background-Color:yellow;}
36
+ #hoge2{background-Color:lime;}
37
+ #hoge3{background-Color:aqua;}
38
+ ```
39
+ ```HTML
40
+ <div id="wrap">
41
+ <div id="header">header</div>
42
+ <div id="hoge1" class="hoge">
43
+ <a href="#hoge1">1</a>
44
+ <a href="#hoge2">2</a>
45
+ <a href="#hoge3">3</a>
46
+ </div>
47
+ <div id="hoge2" class="hoge">
48
+ <a href="#hoge1">1</a>
49
+ <a href="#hoge2">2</a>
50
+ <a href="#hoge3">3</a>
51
+ </div>
52
+ <div id="hoge3" class="hoge">
53
+ <a href="#hoge1">1</a>
54
+ <a href="#hoge2">2</a>
55
+ <a href="#hoge3">3</a>
56
+ </div>
57
+ </div>
25
58
  ```