On my website, I've implemented a Bootstrap Grid design with three columns under the container-fluid
BS attribute, along with .row .no-gutters
.
While the boxes are perfectly aligned in the desktop view, they stack vertically on mobile and tablet devices with width:100%;
, but unfortunately, they're not evenly aligned - as shown in the screenshot attached.
To address this issue, I modified the CSS within the @media
attribute by applying the same styles but removing the padding.
Check out the mobile view screenshot here
Below is the specific code:
/* remove spacing between middle columns */
.row.no-gutter [class*='col-']:not(:first-child):not(:last-child) {
padding-right:5px;
padding-left:5px;
}
/* remove right padding from first column */
.row.no-gutter [class*='col-']:first-child {
padding-right:5px;
}
/* remove left padding from first column */
.row.no-gutter [class*='col-']:last-child {
padding-left:5px;
}
.row{
margin-top: 20px!important;
margin-bottom: 20px!important;
display: block;
height: auto;
}
.legal_section{
padding: 20px!important;
background-color: #F5F5F5!important;
border: 1px solid #EBEBEB!important;
}
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
<script src="https://code.jquery.com/jquery-3.2.1.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>
</head>
<div class="container-fluid">
<div class="row no-gutter">
<div class="col-lg-4">
<div class="well legal_section">
<h4>Privacy Policy</h4>
<p>Our Privacy Policy explains how we use, collect and protect your data when you use our website.</p>
<br/>
<a href="../pages/privacy policy.html" class="std_button">Read More</a>
</div>
</div>
<div class="col-lg-4">
<div class="well legal_section">
<h4>Cookie Policy</h4>
<p>Our Cookie Policy tells you about the use of cookies and how you can choose which cookies we collect and process.</p>
<br/>
<a href="../pages/cookie_policy.html" class="std_button">Read More</a>
</div>
</div>
<div class="col-lg-4">
<div class="well legal_section">
<h4>Terms of Use</h4>
<p>Our Terms of Use specifies the legal use of our website, what your rights are, and how you can contact us. </p>
<br/>
<a href="../pages/website-terms-of-use.html" class="std_button">Read More</a>
</div>
</div>
</div>
</div>