Bootstrap网格不在Codeply或DevTools上工作。 < div class =&quot'col-lg-3 col-md-4 col-sm-6" gt; gt;没有改变

发布于 2025-01-22 05:25:00 字数 2835 浏览 0 评论 0原文

我尝试在头部使用视口元标记。
我尝试使用DIV类=“容器”围绕它。
不管我做什么。它不在Codeply和Chrome DevTools上工作。 但是当我更改浏览器尺寸时,它可以正常工作。 我尝试使用不同的引导版本,但它不起作用。

<!doctype html>
<html lang="en">
  <head>
    
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js" integrity="sha384-7+zCNj/IqJ95wo16oMtfsKbZ9ccEh31eOz1HGyDuCQ6wgnyJNSYdrPa03rtR1zdB" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-QJHtvGhmr9XOIpI6YVutG+2QOK9T+ZnN4kzFN1RtK3zEFEIsxhlmWl5/YESvpZ13" crossorigin="anonymous"></script>
  
 

    <title>Hello, world!</title>
  </head>
  <body>
    <h1>Hello, world!</h1>
<div class="container">


    <div class="row">
      <div class="col" style="background-color:red; border: 1px solid;">
          col
      </div>
      <div class="col" style="background-color:red; border: 1px solid;">
          col
      </div>
  </div>

  <div class="row">
      <div class="col-6" style="background-color:green; border: 1px solid">
          col-6
      </div>
      <div class="col-6" style="background-color:green; border: 1px solid">
          col-6
      </div>
  </div>

  <div class="row">
      <div class="col-lg-3 col-md-4 col-sm-6 " style="background-color:yellow; border: 1px solid">
          col-lg-3 col-md-4 col-sm-6
      </div>
      <div class="col-lg-3 col-md-4 col-sm-6" style="background-color:yellow; border: 1px solid">
          col-lg-3 col-md-4 col-sm-6
      </div>
      <div class="col-lg-3 col-md-4 col-sm-6" style="background-color:yellow; border: 1px solid">
          col-lg-3 col-md-4 col-sm-6
      </div>
      <div class="col-lg-3 col-md-4 col-sm-6" style="background-color:yellow; border: 1px solid">
          col-lg-3 col-md-4 col-sm-6
      </div>
  </div>
</div>
  
  </body>
</html>

I tried using viewport meta tag in head.
I tried using a div class="container" around it.
no matter what i do. its not working on codeply, and chrome devtools.
but its working when i change my browser size.
i tried using different bootstrap versions but its not working.

<!doctype html>
<html lang="en">
  <head>
    
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js" integrity="sha384-7+zCNj/IqJ95wo16oMtfsKbZ9ccEh31eOz1HGyDuCQ6wgnyJNSYdrPa03rtR1zdB" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-QJHtvGhmr9XOIpI6YVutG+2QOK9T+ZnN4kzFN1RtK3zEFEIsxhlmWl5/YESvpZ13" crossorigin="anonymous"></script>
  
 

    <title>Hello, world!</title>
  </head>
  <body>
    <h1>Hello, world!</h1>
<div class="container">


    <div class="row">
      <div class="col" style="background-color:red; border: 1px solid;">
          col
      </div>
      <div class="col" style="background-color:red; border: 1px solid;">
          col
      </div>
  </div>

  <div class="row">
      <div class="col-6" style="background-color:green; border: 1px solid">
          col-6
      </div>
      <div class="col-6" style="background-color:green; border: 1px solid">
          col-6
      </div>
  </div>

  <div class="row">
      <div class="col-lg-3 col-md-4 col-sm-6 " style="background-color:yellow; border: 1px solid">
          col-lg-3 col-md-4 col-sm-6
      </div>
      <div class="col-lg-3 col-md-4 col-sm-6" style="background-color:yellow; border: 1px solid">
          col-lg-3 col-md-4 col-sm-6
      </div>
      <div class="col-lg-3 col-md-4 col-sm-6" style="background-color:yellow; border: 1px solid">
          col-lg-3 col-md-4 col-sm-6
      </div>
      <div class="col-lg-3 col-md-4 col-sm-6" style="background-color:yellow; border: 1px solid">
          col-lg-3 col-md-4 col-sm-6
      </div>
  </div>
</div>
  
  </body>
</html>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

雪落纷纷 2025-01-29 05:25:00

col-sm-6不适合手机。您需要仅使用col-6col-sm-6 width&gt; = 576px的reffers。

col-sm-6 is not for mobiles. You need to use just col-6. col-sm-6 reffers for width >= 576px.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文