回答編集履歴

2

追記を受けて、回答に追記

2022/06/05 23:46

投稿

hatena19
hatena19

スコア33715

test CHANGED
@@ -12,3 +12,23 @@
12
12
  ```
13
13
  サンプル
14
14
  [CSS: Display the content in the center of the browser vertically and horizontally](https://codepen.io/hatena19/pen/PoQOBNw)
15
+
16
+ ---
17
+ > 追記
18
+ > 試してみましたが、残念ながら縦方向はセンターに来るものの縦に並べたいものが横に並んでしまいます。
19
+
20
+ `flex-direction: column;` を追加すれば縦並びになります。
21
+
22
+ ```css
23
+ * {
24
+ margin: 0;
25
+ padding: 0;
26
+ }
27
+ body {
28
+ display: flex;
29
+ justify-content: center;
30
+ align-items: center;
31
+ flex-direction: column;
32
+ min-height: 100vh;
33
+ }
34
+ ```

1

サンプル追加

2022/05/26 00:58

投稿

hatena19
hatena19

スコア33715

test CHANGED
@@ -10,3 +10,5 @@
10
10
  padding:0;
11
11
  }
12
12
  ```
13
+ サンプル
14
+ [CSS: Display the content in the center of the browser vertically and horizontally](https://codepen.io/hatena19/pen/PoQOBNw)