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

回答編集履歴

3

コード追記

2020/09/23 02:14

投稿

hatena19
hatena19

スコア34367

answer CHANGED
@@ -8,4 +8,39 @@
8
8
  justify-content: center;
9
9
  align-items: center;
10
10
  }
11
- ```
11
+ ```
12
+
13
+ ---
14
+ [https://popo-design.net/template](https://popo-design.net/template)/
15
+ の最初のテンプレートを使っているのですね。
16
+ テンプレートをダウンロードしてみました。
17
+ bootstrap的なCSSフレームワークな造りになっているので、既存のクラスを修正するのは他の部分に影響を及ぼしますので、修正したい要素にクラスを追加して、そのクラスにCSSを設定するようにした方がいいでしょう。
18
+
19
+ ```HTML
20
+ <div class="row flow">
21
+ <div class="col span-3 flex-col">
22
+ <img src="https://placehold.jp/150x150.png">
23
+ </div>
24
+ <div class="col span-9 flex-col">
25
+ <h3>ここに題名が入ります。ここに題名が入ります。</h3>
26
+ <p>ここに文章が入ります。ここに文章が入ります。ここに文章が入ります。</p>
27
+ </div>
28
+ </div>
29
+ ```
30
+ 画像の親要素と、題名、文章の親要素に、flex-col というクラスを追加します。
31
+
32
+ ```css
33
+ .flex-col {
34
+ display: flex;
35
+ flex-direction: column;
36
+ justify-content: center;
37
+ align-items: center;
38
+ }
39
+
40
+ /* 以下はお好みで */
41
+ .flex-col > img {
42
+ width: 100%; /* 画像の幅を親要素に揃える */
43
+ }
44
+ ```
45
+
46
+ 以上でどうでしょう。

2

コード削除

2020/09/23 02:14

投稿

hatena19
hatena19

スコア34367

answer CHANGED
@@ -8,40 +8,4 @@
8
8
  justify-content: center;
9
9
  align-items: center;
10
10
  }
11
- ```
12
-
13
- ---
14
- 現状のCSSの提示がないので、画像とクラス名から適当に想像したコード例です。
15
- ご参考までに。
16
-
17
- ```css
18
- .center {
19
- text-align: center;
20
- }
21
-
22
- .row {
23
- display: flex;
24
- flex-wrap: wrap;
25
- justify-content: center;
26
- margin-bottom: 10px;
27
- }
28
- .span-3 {
29
- width: 25%;
30
- min-width: 200px;
31
- display: flex;
32
- justify-content: center;
33
- align-items: center;
34
- }
35
-
36
- .span-3 img {
37
- width: 100%;
38
- }
39
-
40
- .span-9 {
41
- width: 75%;
42
- display: flex;
43
- flex-direction: column;
44
- justify-content: center;
45
- align-items: center;
46
- }
47
11
  ```

1

コード追記

2020/09/22 13:26

投稿

hatena19
hatena19

スコア34367

answer CHANGED
@@ -8,4 +8,40 @@
8
8
  justify-content: center;
9
9
  align-items: center;
10
10
  }
11
+ ```
12
+
13
+ ---
14
+ 現状のCSSの提示がないので、画像とクラス名から適当に想像したコード例です。
15
+ ご参考までに。
16
+
17
+ ```css
18
+ .center {
19
+ text-align: center;
20
+ }
21
+
22
+ .row {
23
+ display: flex;
24
+ flex-wrap: wrap;
25
+ justify-content: center;
26
+ margin-bottom: 10px;
27
+ }
28
+ .span-3 {
29
+ width: 25%;
30
+ min-width: 200px;
31
+ display: flex;
32
+ justify-content: center;
33
+ align-items: center;
34
+ }
35
+
36
+ .span-3 img {
37
+ width: 100%;
38
+ }
39
+
40
+ .span-9 {
41
+ width: 75%;
42
+ display: flex;
43
+ flex-direction: column;
44
+ justify-content: center;
45
+ align-items: center;
46
+ }
11
47
  ```