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

回答編集履歴

4

Flexbox版を追記

2018/07/11 11:21

投稿

root_jp
root_jp

スコア4666

answer CHANGED
@@ -33,4 +33,21 @@
33
33
  #list figcaption {
34
34
  width: 150px;
35
35
  }
36
+ ```
37
+
38
+ ### 追記 Flexbox版
39
+ ```CSS
40
+ #list {
41
+ display: flex;
42
+ flex-wrap: wrap;
43
+ width: 570px;
44
+ }
45
+
46
+ #list figure {
47
+ margin: 20px;
48
+ }
49
+
50
+ #list figcaption {
51
+ width: 150px;
52
+ }
36
53
  ```

3

質問にある手書きの内容に近づけた

2018/07/11 11:21

投稿

root_jp
root_jp

スコア4666

answer CHANGED
@@ -1,24 +1,24 @@
1
1
  ```HTML
2
2
  <article id="list">
3
3
  <figure>
4
- <img src="https://placehold.jp/150x150.png" alt="">
4
+ <img src="https://placehold.jp/150x150.png" alt="写真1">
5
- <figcaption>写真1</figcaption>
5
+ <figcaption>写真1のタイトル</figcaption>
6
6
  </figure>
7
7
  <figure>
8
- <img src="https://placehold.jp/150x150.png" alt="">
8
+ <img src="https://placehold.jp/150x150.png" alt="写真2">
9
- <figcaption>写真2</figcaption>
9
+ <figcaption>写真2のタイトル</figcaption>
10
10
  </figure>
11
11
  <figure>
12
- <img src="https://placehold.jp/150x150.png" alt="">
12
+ <img src="https://placehold.jp/150x150.png" alt="写真3">
13
- <figcaption>写真3</figcaption>
13
+ <figcaption>写真3のタイトル</figcaption>
14
14
  </figure>
15
15
  <figure>
16
- <img src="https://placehold.jp/150x150.png" alt="">
16
+ <img src="https://placehold.jp/150x150.png" alt="写真4">
17
- <figcaption>写真4</figcaption>
17
+ <figcaption>写真4のタイトル</figcaption>
18
18
  </figure>
19
19
  <figure>
20
- <img src="https://placehold.jp/150x150.png" alt="">
20
+ <img src="https://placehold.jp/150x150.png" alt="写真5">
21
- <figcaption>写真5</figcaption>
21
+ <figcaption>写真5のタイトル</figcaption>
22
22
  </figure>
23
23
  </article>
24
24
  ```
@@ -29,4 +29,8 @@
29
29
  grid-template-columns: repeat(3, 150px);
30
30
  grid-column-gap: 20px;
31
31
  }
32
+
33
+ #list figcaption {
34
+ width: 150px;
35
+ }
32
36
  ```

2

写真のタイトルの考慮が抜けてたため修正

2018/07/11 08:38

投稿

root_jp
root_jp

スコア4666

answer CHANGED
@@ -1,17 +1,32 @@
1
1
  ```HTML
2
- <div id="list">
2
+ <article id="list">
3
+ <figure>
3
- <img src="https://placehold.jp/150x150.png" alt="">
4
+ <img src="https://placehold.jp/150x150.png" alt="">
5
+ <figcaption>写真1</figcaption>
6
+ </figure>
7
+ <figure>
4
- <img src="https://placehold.jp/150x150.png" alt="">
8
+ <img src="https://placehold.jp/150x150.png" alt="">
9
+ <figcaption>写真2</figcaption>
10
+ </figure>
11
+ <figure>
5
- <img src="https://placehold.jp/150x150.png" alt="">
12
+ <img src="https://placehold.jp/150x150.png" alt="">
13
+ <figcaption>写真3</figcaption>
14
+ </figure>
15
+ <figure>
6
- <img src="https://placehold.jp/150x150.png" alt="">
16
+ <img src="https://placehold.jp/150x150.png" alt="">
17
+ <figcaption>写真4</figcaption>
18
+ </figure>
19
+ <figure>
7
- <img src="https://placehold.jp/150x150.png" alt="">
20
+ <img src="https://placehold.jp/150x150.png" alt="">
21
+ <figcaption>写真5</figcaption>
8
- </div>
22
+ </figure>
23
+ </article>
9
24
  ```
10
25
 
11
26
  ```CSS
12
27
  #list {
13
28
  display: grid;
14
29
  grid-template-columns: repeat(3, 150px);
15
- grid-gap: 20px 20px;
30
+ grid-column-gap: 20px;
16
31
  }
17
32
  ```

1

変更

2018/07/11 08:27

投稿

root_jp
root_jp

スコア4666

answer CHANGED
@@ -11,7 +11,7 @@
11
11
  ```CSS
12
12
  #list {
13
13
  display: grid;
14
- grid-template-columns: 150px 150px 150px;
14
+ grid-template-columns: repeat(3, 150px);
15
15
  grid-gap: 20px 20px;
16
16
  }
17
17
  ```