col-12 ,col-sm-6 and col-md -4 grid issue in bootstrap
i have defined the classes in my div but when i add col-md-4 all of the columns are start taking equal width as col-md-4 even sm screen sizes are also taking same width as col-md-4 here is my code"
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap Responsive Grid Example</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
</head>
<style>
</style>
<body>
<div class="container">
<div class="row">
<!-- For Extra Small and Small Devices (col-12 col-sm-6) -->
<div class="col-12 col-sm-6 col-md-4 col-lg-3">
<div class="bg-primary p-3">Column 1 (100%)</div>
</div>
<div class="col-12 col-sm-6 col-md-4 col-lg-3">
<div class="bg-success p-3">Column 2 (50%)</div>
</div>
<div class="col-12 col-sm-6 col-md-4 col-lg-3">
<div class="bg-warning p-3">Column 3 (50%)</div>
</div>
<!-- For Medium Devices (col-md-4) -->
<!-- For Large Devices (col-lg-3) -->
</div>
</div>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
</body>
</html>
0 Replies