0

我希望我的卡片覆盖屏幕的相等宽度,但我下面的代码是根据内容。

试过了card-deck,但没有帮助。

<!DOCTYPE html>
<html>

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
  <script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
  <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
  <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.0-2/css/all.min.css" rel="stylesheet">

</head>

<body>

  <div class="container p-3 bg-white rounded">

    <div class="row">

      <div id="carouselExampleIndicators" class="carousel slide carousel-fade" data-ride="carousel">

        <div class="carousel-inner">



          <div class="carousel-item active">
            <div class="row">

              <div class="col-lg-3">
                <div class="card text-white bg-primary">
                  <div class="card-body">
                    <h5 class="card-title">0-10</h5>
                    <p class="card-text">00</p>
                  </div>
                </div>
              </div>


              <div class="col-lg-3">
                <div class="card text-white bg-primary">
                  <div class="card-body">
                    <h5 class="card-title">1-9</h5>
                    <p class="card-text">00</p>
                  </div>
                </div>
              </div>


              <div class="col-lg-3">
                <div class="card text-white bg-primary">
                  <div class="card-body">
                    <h5 class="card-title">2-8</h5>
                    <p class="card-text">00</p>
                  </div>
                </div>
              </div>


              <div class="col-lg-3">
                <div class="card text-white bg-primary">
                  <div class="card-body">
                    <h5 class="card-title">3-7</h5>
                    <p class="card-text">00</p>
                  </div>
                </div>
              </div>


            </div>
          </div>


          <div class="carousel-item ">
            <div class="row">

              <div class="col-lg-3">
                <div class="card text-white bg-primary">
                  <div class="card-body">
                    <h5 class="card-title">4-6</h5>
                    <p class="card-text">00</p>
                  </div>
                </div>
              </div>


              <div class="col-lg-3">
                <div class="card text-white bg-primary">
                  <div class="card-body">
                    <h5 class="card-title">5-5</h5>
                    <p class="card-text">00</p>
                  </div>
                </div>
              </div>


              <div class="col-lg-3">
                <div class="card text-white bg-primary">
                  <div class="card-body">
                    <h5 class="card-title">6-4</h5>
                    <p class="card-text">00</p>
                  </div>
                </div>
              </div>


              <div class="col-lg-3">
                <div class="card text-white bg-primary">
                  <div class="card-body">
                    <h5 class="card-title">7-3</h5>
                    <p class="card-text">00</p>
                  </div>
                </div>
              </div>


            </div>
          </div>


        </div>
      </div>


    </div>
  </div>
</body>

</html>

我希望我的卡片覆盖屏幕的相等宽度,但我下面的代码是根据内容。

试过了card-deck,但没有帮助。

我希望我的卡片覆盖屏幕的相等宽度,但我下面的代码是根据内容。

试过了card-deck,但没有帮助。

4

2 回答 2

0

尝试像这样使用 .card-columns 类:

<div class="card-columns">

    <div id="card1" class="card">
        
        <img class="card-img-top" src="" alt="Card image cap">

        <div class="card-body">
            <h5 class="card-title">
                CARD 1 TITLE
            </h5>
        </div>

        <div class="card-body">
            CARD 1 BODY
        </div>

    </div>
    
    <div id="card2" class="card">
        
        <img class="card-img-top" src="" alt="Card image cap">

        <div class="card-body">
            <h5 class="card-title">
                CARD 2 TITLE
            </h5>
        </div>

        <div class="card-body">
            CARD 2 BODY
        </div>

    </div>

</div>

并删除rowcol div,card-columns 类负责其余部分

于 2020-08-01T22:54:27.990 回答
0

在 div 块中更改col-lg-3col-lg-auto,使其在屏幕上占据相等的宽度

于 2020-08-01T19:05:22.593 回答