質問編集履歴

4

試したことを追加しました

2022/12/14 14:56

投稿

wkou4627
wkou4627

スコア13

test CHANGED
File without changes
test CHANGED
@@ -269,6 +269,19 @@
269
269
  どうやら、display: flex;が影響しているようです。
270
270
  余白を埋めるために、flex-growを追加してみましたが、うまくいきません。
271
271
 
272
+ ・.top-wrapper {
273
+ width: 960px;
274
+ height: 100px;
275
+ /* margin: 0 auto;*/
276
+ margin: 0; /*追加*/
277
+ padding: 0 4%;
278
+ box-sizing: border-box;
279
+ display: flex;
280
+  justify-content: space-between;
281
+ align-items: center;
282
+
283
+ display: flex がうまく効かない原因の1つに、「他のmarginの影響を受けている」ことがあるらしいので、margin: 0; を追加してみました。一見すると解決したかのような表示になりましたが、デベロッパーツールを確認すると中心がズレてしまいます・・・。
284
+
272
285
 
273
286
 
274
287
  ### 補足情報(FW/ツールのバージョンなど)

3

ソースコードの変更

2022/12/14 14:07

投稿

wkou4627
wkou4627

スコア13

test CHANGED
File without changes
test CHANGED
@@ -17,8 +17,16 @@
17
17
  ### 該当のソースコード
18
18
 
19
19
  ```HTML
20
+ <!DOCTYPE html>
21
+ <html lang="ja">
20
- ーーー省略ーーー
22
+ <head>
21
-
23
+ <meta charset="UTF-8">
24
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
25
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
26
+ <title>模写コーディング2</title>
27
+ <meta name="description" content="text text text text text text text text">
28
+ <link rel="stylesheet" href="./assets/css/style.css">
29
+ </head>
22
30
  <body>
23
31
  <header>
24
32
  <div class="top-wrapper">
@@ -36,11 +44,83 @@
36
44
 
37
45
  </div>
38
46
  </header>
39
-
47
+ <main>
48
+ <div>
49
+ <img class="visual" src="./assets/img/mainvisual.jpg" alt="mainvisual">
50
+ </div>
51
+
52
+ <section class="wrapper">
53
+ <h2 class="title">About</h2>
54
+ <div id="toabout" class="about">
55
+ <div class="about-img">
56
+ <img class="icon" src="./assets/img/about.jpg" alt="about.jpg" width="100px" height="100px
40
- ーーー省略ーーー
57
+ ">
58
+ </div>
59
+
60
+ <div class="about-direction">
61
+ <p class="introdaction">KIYORI HIRASAWA</p>
62
+ <p class="text">
63
+ テキストテキストテキストテキストテキストテキストテキスト<br>
64
+ テキストテキストテキストテキストテキストテキストテキスト<br>
65
+ テキストテキストテキストテキストテキストテキストテキスト
66
+ </p>
67
+
68
+ </div>
69
+ </div>
70
+ </section>
71
+
72
+ <section class="wrapper">
73
+ </section>
74
+
75
+ <section class="wrapper">
76
+ <h3 id="tobicycle" class="title">Bicycle</h3>
77
+
78
+ <div class="bicycle">
79
+
80
+ <div class="works">
81
+ <figure class="work">
82
+ <img src="./assets/img/bicycle1.jpg" alt="bicycle images" class="work-img" width="300px" height="250px">
83
+ <p class="work-title">タイトルタイトル</p>
84
+ <figcaption class="work-text">
85
+ テキストテキストテキスト
86
+ </figcaption>
87
+ </figure>
88
+ </div>
89
+
90
+ <div class="works">
91
+ <figure class="work">
92
+ <img src="./assets/img/bicycle2.jpg" alt="bicycle images" class="work-img" width="300px" height="250px">
93
+ <p class="work-title">タイトルタイトル</p>
94
+ <figcaption class="work-text">
95
+ テキストテキストテキスト
96
+ </figcaption>
97
+ </figure>
98
+ </div>
99
+
100
+ <div class="works">
101
+ <figure class="work">
102
+ <img src="./assets/img/bicycle3.jpg" alt="bicycle images" class="work-img" width="300px" height="250px">
103
+ <p class="work-title">タイトルタイトル</p>
104
+ <figcaption class="work-text">
105
+ テキストテキストテキスト
106
+ </figcaption>
107
+ </figure>
108
+ </div>
109
+
110
+ </div>
111
+ </section>
112
+ </main>
113
+
114
+ <footer>
115
+ <p class="footer">&copy 2020 Profile</p>
116
+ </footer>
117
+ </body>
118
+ </html>
41
119
  ```
42
120
 
43
121
  ```css
122
+ @charset "UTF-8";
123
+
44
124
  /*-----全体-------*/
45
125
  * {
46
126
  margin: 0;
@@ -64,12 +144,13 @@
64
144
  box-sizing: border-box;
65
145
  display: flex;
66
146
  align-items: center;
67
- /* flex-grow: */
147
+ justify-content: space-between;
148
+
68
149
  }
69
150
 
70
151
  .logo {
71
- weight: 15px;
152
+ width: 150px;
72
- height: 30px;
153
+ height: 200px;
73
154
  }
74
155
 
75
156
  /* .wrapper-left {
@@ -80,10 +161,92 @@
80
161
 
81
162
  ul {
82
163
  display: flex;
164
+ /* justify-content: space-between; */
83
165
  }
84
166
 
85
167
  li {
86
168
  padding-left: 25px;
169
+ }
170
+ /*------mainvisual--------*/
171
+
172
+ .visual {
173
+ height: 600px;
174
+ min-width: 100vw;
175
+ padding-bottom: 100px;
176
+ }
177
+
178
+
179
+ /*-----about-------*/
180
+
181
+ .wrapper {
182
+ width: 960px;
183
+ margin: 0 auto;
184
+ text-align: center;
185
+ padding: 0 4%;
186
+ box-sizing: border-box;
187
+ }
188
+
189
+ .title {
190
+ display: inline;
191
+ border-bottom: 1px solid;
192
+ padding-bottom: 5px;
193
+ font-size: 24px;
194
+ }
195
+
196
+ .about {
197
+ display: flex;
198
+ justify-content: center;
199
+ padding: 50px;
200
+ }
201
+
202
+ /* .about-img {} */
203
+
204
+ .icon {
205
+ border-radius: 50%;
206
+ }
207
+
208
+ .about-direction {
209
+ text-align: left;
210
+ padding-left: 50px;
211
+ }
212
+
213
+ /* .introdaction {
214
+
215
+ }
216
+
217
+ .text {
218
+
219
+ } */
220
+
221
+ /*------bicycle-------*/
222
+
223
+ .bicycle {
224
+ display: flex;
225
+ justify-content: center;
226
+ padding: 50px;
227
+
228
+ }
229
+
230
+ .works {
231
+ margin-right: 10px
232
+ }
233
+
234
+ .work-title {
235
+ font-weight: bold;
236
+ }
237
+
238
+ .work-text{
239
+ padding-top: 0px;
240
+ }
241
+
242
+
243
+ /*------footer------*/
244
+
245
+ .footer {
246
+ display: block;
247
+ text-align: center;
248
+ font-size: 12px;
249
+ padding-top: 100px
87
250
  }
88
251
  ```
89
252
 
@@ -106,6 +269,8 @@
106
269
  どうやら、display: flex;が影響しているようです。
107
270
  余白を埋めるために、flex-growを追加してみましたが、うまくいきません。
108
271
 
272
+
273
+
109
274
  ### 補足情報(FW/ツールのバージョンなど)
110
275
 
111
276
  ここにより詳細な情報を記載してください。

2

試したことを追記しました。

2022/12/13 15:03

投稿

wkou4627
wkou4627

スコア13

test CHANGED
File without changes
test CHANGED
@@ -88,8 +88,21 @@
88
88
  ```
89
89
 
90
90
  ### 試したこと
91
+ ・.top-wrapper {
92
+ width: 960px;
93
+ height: 100px;
94
+ margin: 0 auto;
95
+ padding: 0 4%;
96
+ box-sizing: border-box;
97
+ display: flex;
98
+  justify-content: space-between; /*追加*/
99
+ align-items: center;
91
100
 
101
+ 以下のようにアイコンの位置がズレてしまいました。
102
+ ![イメージ説明](https://ddjkaamml8q8x.cloudfront.net/questions/2022-12-14/55dc09c9-6560-4e10-b9f2-6c1494d897c9.jpeg)
103
+
104
+  
92
- デベロッパーツールで要素に紫の斜線が表示されていることを確認しました。
105
+ デベロッパーツールで要素に紫の斜線が表示されていることを確認しました。
93
106
  どうやら、display: flex;が影響しているようです。
94
107
  余白を埋めるために、flex-growを追加してみましたが、うまくいきません。
95
108
 

1

CSSに間違いがあったため変更しました。

2022/12/13 13:33

投稿

wkou4627
wkou4627

スコア13

test CHANGED
File without changes
test CHANGED
@@ -80,7 +80,6 @@
80
80
 
81
81
  ul {
82
82
  display: flex;
83
- justify-content: space-between;
84
83
  }
85
84
 
86
85
  li {