在最小的HTML程式碼中,Bootstrap的d-flex無法正常運作
P粉465675962
P粉465675962 2023-09-13 23:50:12
0
1
578

我正在創建一個Bootstrap網站,但我已經遇到了一個問題,即使使用最簡單的HTML也無法解決這個問題(這個問題是網站上唯一的元素)...我感到絕望:

<!DOCTYPE html>
<html lang="fr">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Association Capucine - Gagner contre la leucémie</title>
</head>
<body>
  <div class="d-flex justify-content-around">
    <div class="p-2 bg-info">Flex item 1</div>
    <div class="p-2 bg-warning">Flex item 2</div>
    <div class="p-2 bg-primary">Flex item 3</div>
  </div>
  <main>
  </main>
  <footer>
  </footer>
</body>

</html>

提前感謝

P粉465675962
P粉465675962

全部回覆(1)
P粉604669414

您需要包含Bootstrap CSS和Bootstrap JS。

請參考下面的程式碼片段。

<!DOCTYPE html>
<html lang="fr">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Association Capucine - Gagner contre la leucémie</title>
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-9ndCyUaIbzAi2FUVXJi0CjmCapSmO7SnpJef0486qhLnuZ2cdeRhO02iuK6FUUVM" crossorigin="anonymous">
</head>

<body>
  <div class="d-flex justify-content-around">
    <div class="p-2 bg-info">Flex item 1</div>
    <div class="p-2 bg-warning">Flex item 2</div>
    <div class="p-2 bg-primary">Flex item 3</div>
  </div>

  <main>
  </main>

  <footer>
  </footer>

  <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-geWF76RCwLtnZ8qwWowPQNguL3RmwHVBC9FhGdlKrxdiJJigb/j/68SIy3Te4Bkz" crossorigin="anonymous"></script>
</body>

</html>
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板