Copy link to clipboard
Copied
I have created a somewhat responsive bootstrap layout using the grid system however I wanted to know whether there was a way the column could disappear completely when the screen gets below a certain number of pixels. As you can see from the html, when the screen gets below 767px the side columns go to 1 and the main column goes to 10, but is there a way these side columns can just disappear and the main column can fill up the whole screen?
HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Game Canvas</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="Open Source Images" />
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="css/bootstrap.css">
<!--My CSS-->
<link rel="stylesheet" href="css/main.css" style="text/css">
</head>
<body>
<header>
<div class="container">
<nav class="navbar navbar-toggleable-md navbar-light">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button>
<a class="navbar-brand" href="#"> <img src="assets/logoblue.png" width="30" height="30" class="d-inline-block align-top" alt=""> Game Canvas </a>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item active"> <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a> </li>
<li class="nav-item"> <a class="nav-link" href="#">Link</a> </li>
<li class="nav-item"> <a class="nav-link" href="#">Link 2</a> </li>
</ul>
<form class="form-inline my-2 my-lg-0">
<input class="form-control mr-sm-2" type="text" placeholder="Search">
<button class="btn btn-outline-gamecanvas my-2 my-sm-0" type="submit">Search</button>
</form>
</div>
</nav>
</div>
<div class="pageheader">
<div class="container">
<h1 class="display-3">My Website</h1>
<p>Something</p>
</div>
</div>
<div class="pageheader2"></div>
<div class="pageheader3"></div>
</header>
<div class="container">
<div class="row">
<div class="col-md-3 col-sm-1">
<h6>Left Column</h6>
</div>
<div class="col-md-6 col-sm-10">
<h6>Main Column</h6>
</div>
<div class="col-md-3 col-sm-0%">
<h6>Right Column</h6>
</div>
</div>
</div>
<!-- jQuery first, then Tether, then Bootstrap JS. -->
<script src="js/jquery-3.1.1.min.js"></script>
<script src="js/tether.min.js"></script>
<script src="js/bootstrap.min.js"></script>
</body>
</html>
CSS:
.pageheader {
padding: 15px 15px;
color: #00B4E3;
text-align: center;
background-color: #00647E;
}
.pageheader h1 {
color: #fff;
font-weight: 300;
}
.pageheader p {
font-size: 20px;
}
.pageheader2 {
padding: 5px 5px;
background-color: #00B4E3;
}
.pageheader3 {
padding: 5px 5px;
margin-bottom: 25px;
background-color: #75E2FF;
}
NOTE: in Bootstrap version 4x, the hidden & visible classes have been replaced with .hidden-xs-up,
.hidden-xs-down,
.hidden-sm-up,
.hidden-sm-down,
.hidden-md-up,
.hidden-md-down,
.hidden-lg-up,
.hidden-lg-down
.
If you're using Bootstrap 4 as you were in other posts, you can hide a <div> on sm & xs devices with this code.
<div class="col-md-3 hidden-sm-down
">
If you switched to Bootstrap version 3, you would use this code:
<div class="col-md-3 hidden-sm hidden-xs
">
Nancy
Copy link to clipboard
Copied
Apply hidden and or visible class as per http://getbootstrap.com/css/#responsive-utilities
Copy link to clipboard
Copied
NOTE: in Bootstrap version 4x, the hidden & visible classes have been replaced with .hidden-xs-up,
.hidden-xs-down,
.hidden-sm-up,
.hidden-sm-down,
.hidden-md-up,
.hidden-md-down,
.hidden-lg-up,
.hidden-lg-down
.
If you're using Bootstrap 4 as you were in other posts, you can hide a <div> on sm & xs devices with this code.
<div class="col-md-3 hidden-sm-down
">
If you switched to Bootstrap version 3, you would use this code:
<div class="col-md-3 hidden-sm hidden-xs
">
Nancy
Find more inspiration, events, and resources on the new Adobe Community
Explore Now