Bootstrap网格不在Codeply或DevTools上工作。 < div class =&quot'col-lg-3 col-md-4 col-sm-6" gt; gt;没有改变
我尝试在头部使用视口元标记。
我尝试使用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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
col-sm-6
不适合手机。您需要仅使用col-6
。col-sm-6
width&gt; = 576px的reffers。col-sm-6
is not for mobiles. You need to use justcol-6
.col-sm-6
reffers for width >= 576px.