cari

Rumah  >  Soal Jawab  >  teks badan

Mengapa CSS Flexbox saya tidak berfungsi dengan betul?

Mengapa display:flex tidak berfungsi dalam kod CSS saya? Saya mahu bahagian kod HTML saya ini berada di tengah-tengah halaman.

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粉805535434P粉805535434383 hari yang lalu407

membalas semua(1)saya akan balas

  • P粉639667504

    P粉6396675042024-02-04 20:09:17

    flex auto 0 1display 的无效属性值。您的浏览器的文档检查器将向您显示这一点。您需要在 displayflex Asingkan nilai ini dalam atribut.

    Saya ragu anda mahu lebih flex-direction: column, tetapi saya serahkan kepada anda.

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

    score :0

    What is 1 multiply by 1?

    balas
    0
  • Batalbalas