質問編集履歴

1

内容の追加

2019/03/06 11:23

投稿

omyu
omyu

スコア22

test CHANGED
File without changes
test CHANGED
@@ -1,3 +1,219 @@
1
1
  z-indexを例えば10に指定すると、その要素はfloatと同じく浮いていることになるのでしょうか。
2
2
 
3
3
  浮いているとしたら、floatと同じようにclearプロパティやclearfixの技法で直すことはできるのでしょうか。
4
+
5
+ ある要素にposition:fixedとz-index:10を指定すると、その下の要素が上の要素に潜り込み重なってしまいます。下の要素のmargin-topを75pxに指定してレイアウトを整える以外に解決法はあるのでしょうか。
6
+
7
+ ```HTML
8
+
9
+ <html lang="ja">
10
+
11
+ <head>
12
+
13
+ <meta charset="UTF-8">
14
+
15
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
16
+
17
+ <meta http-equiv="X-UA-Compatible" content="ie=edge">
18
+
19
+ <title>Document</title>
20
+
21
+ <link rel="stylesheet" href="stylesheet.css">
22
+
23
+ </head>
24
+
25
+ <body>
26
+
27
+ <header>
28
+
29
+ <div class="container">
30
+
31
+ <div class="header-left">
32
+
33
+ <img src="images/isaralogo.png" alt="isara" class="header-logo">
34
+
35
+ <p class="h1">バンコクのノマドエンジニア育成講座</p>
36
+
37
+ </div>
38
+
39
+ <div class="header-right">
40
+
41
+ <a href="#">お問い合わせ / 資料請求はこちら</a>
42
+
43
+ </div>
44
+
45
+ </div>
46
+
47
+ </header>
48
+
49
+ <div id="wrap">
50
+
51
+ <section class="top">
52
+
53
+ <p class="text1">プログラミングで</p>
54
+
55
+ <p class="text1">人生の安定を手にいれよう</p>
56
+
57
+ <img src="images/isaralogolarge.png" alt="isara">
58
+
59
+ <p class="text2">バンコクのノマドエンジニア育成講座</p>
60
+
61
+ <p class="text2">iSara[イサラ]</p>
62
+
63
+ </section>
64
+
65
+
66
+
67
+ </div>
68
+
69
+ </body>
70
+
71
+ </html>
72
+
73
+ ```
74
+
75
+ ```CSS
76
+
77
+ @charset "utf-8";
78
+
79
+
80
+
81
+ * {
82
+
83
+ box-sizing: border-box;
84
+
85
+ text-decoration: none;
86
+
87
+ }
88
+
89
+ body {
90
+
91
+ margin:0;
92
+
93
+ }
94
+
95
+ header {
96
+
97
+ height:75px;
98
+
99
+ width:100%;
100
+
101
+ background-color:white;
102
+
103
+ position:fixed;
104
+
105
+ top:0px;
106
+
107
+ }
108
+
109
+ header:after {
110
+
111
+ content:"";
112
+
113
+ display:block;
114
+
115
+ clear:both;
116
+
117
+ }
118
+
119
+ .container {
120
+
121
+ width:1170px;
122
+
123
+ height:75px;
124
+
125
+ margin:0 auto;
126
+
127
+ }
128
+
129
+ .header-left {
130
+
131
+ float:left;
132
+
133
+ width:400px;
134
+
135
+ height:75px;
136
+
137
+ }
138
+
139
+ .header-logo {
140
+
141
+ margin-top:17px;
142
+
143
+ width:120px;
144
+
145
+ float:left;
146
+
147
+ }
148
+
149
+ .header-left .h1 {
150
+
151
+ margin: 37px 0 0 0;
152
+
153
+ font-size: 14px;
154
+
155
+ color: #333333;
156
+
157
+ font-weight:600;
158
+
159
+ letter-spacing: 2px;
160
+
161
+ }
162
+
163
+ .header-right {
164
+
165
+ float:right;
166
+
167
+ width:320px;
168
+
169
+ height:45px;
170
+
171
+ margin-top:15px;
172
+
173
+ background-color: #da6b64;
174
+
175
+ border-radius:25px;
176
+
177
+ }
178
+
179
+ .header-right a {
180
+
181
+ line-height: 45px;
182
+
183
+ font-weight:300;
184
+
185
+ font-size: 14px;
186
+
187
+ text-align:center;
188
+
189
+ color:white;
190
+
191
+ letter-spacing: 2px;
192
+
193
+ display:block;
194
+
195
+ }
196
+
197
+ .header-right:hover {
198
+
199
+ background-color:#dc143c;
200
+
201
+ }
202
+
203
+ #wrap {
204
+
205
+ margin-top:75px;
206
+
207
+ }
208
+
209
+ .top {
210
+
211
+ width:1170px;
212
+
213
+ margin:0 auto;
214
+
215
+ }
216
+
217
+
218
+
219
+ ```