I tried using viewport meta tag in head.
I tried using a div 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 >
<div >
<div style="background-color:red; border: 1px solid;">
col
</div>
<div style="background-color:red; border: 1px solid;">
col
</div>
</div>
<div >
<div style="background-color:green; border: 1px solid">
col-6
</div>
<div style="background-color:green; border: 1px solid">
col-6
</div>
</div>
<div >
<div style="background-color:yellow; border: 1px solid">
col-lg-3 col-md-4 col-sm-6
</div>
<div style="background-color:yellow; border: 1px solid">
col-lg-3 col-md-4 col-sm-6
</div>
<div style="background-color:yellow; border: 1px solid">
col-lg-3 col-md-4 col-sm-6
</div>
<div style="background-color:yellow; border: 1px solid">
col-lg-3 col-md-4 col-sm-6
</div>
</div>
</div>
</body>
</html>
CodePudding user response:
<!DOCTYPE html>
<head>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA 058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-ApNbgh9B Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5 76PVCmYl" crossorigin="anonymous"></script>
</head>
<body>
<div >
<div style="background-color:red; border: 1px solid;">
col
</div>
<div style="background-color:red; border: 1px solid;">
col
</div>
</div>
<div >
<div style="background-color:green; border: 1px solid">
col-6
</div>
<div style="background-color:green; border: 1px solid">
col-6
</div>
</div>
<div >
<div style="background-color:yellow; border: 1px solid">
col-lg-3 col-md-4 col-sm-6
</div>
<div style="background-color:yellow; border: 1px solid">
col-lg-3 col-md-4 col-sm-6
</div>
<div style="background-color:yellow; border: 1px solid">
col-lg-3 col-md-4 col-sm-6
</div>
<div style="background-color:yellow; border: 1px solid">
col-lg-3 col-md-4 col-sm-6
</div>
</div>
</body>
</html>
CodePudding user response:
col-sm-6
is not for mobiles. You need to use just col-6
. col-sm-6
reffers for width >= 576px.