Warum funktioniert mein Flexbox-CSS nicht richtig?
P粉805535434
P粉805535434 2024-02-03 22:23:08
0
1
399

Warum funktioniert display:flex nicht in meinem CSS-Code? Ich möchte, dass sich dieser Teil meines HTML-Codes in der Mitte der Seite befindet.

body {
  margin: 0;
  display: flex auto 0 1;
  justify-content: center;
  height: 100vh;
}
<form class="form" id="form"></form>
<h4 class="score" id="score">score :0</h4>
<h1 id="Question">What is 1 multiply by 1?</h1>
<input type="text" class="input" id="input" placeholder="Enter your answer" autofocus autocomplete="off">
<button type="submit" class="btn">submit</button>

P粉805535434
P粉805535434

Antworte allen(1)
P粉639667504

flex auto 0 1display 的无效属性值。您的浏览器的文档检查器将向您显示这一点。您需要在 displayflex 属性中分隔这些值。

我怀疑您还想要 flex-direction: column,但我会将其留给您。

body {
  margin: 0;
  display: flex;
  flex: auto 0 1;
  justify-content: center;
  height: 100vh;
}

score :0

What is 1 multiply by 1?

Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage