I'm setting up a gallery using bootstrap, however the Y gutters seem to have no effect on the grid. What I would like is to have all of the gutters (especially the Y's) the same size as the left and right sides. Here's a working pen: https://codepen.io/fullstackgenerator/pen/gOeENKr
body {
margin: 0;
}
.gallery {
background-color: rgb(0, 0, 0);
max-height: 100%;
max-width: 100%;
}
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.4.1/dist/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
<link rel="stylesheet" href="custom.css">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>title</title>
</head>
<body>
<div class="gallery" id="gallery">
<div class="container-fluid">
<div class="row gy-0">
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
<img class="img-responsive" src="https://fakeimg.pl/365x245/" alt="img"></div>
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
<img class="img-responsive" src="https://fakeimg.pl/365x245/" alt="img"></div>
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
<img class="img-responsive" src="https://fakeimg.pl/365x245/" alt="img"></div>
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
<img class="img-responsive" src="https://fakeimg.pl/365x245/" alt="img"></div>
</div>
<div class="row gy-0">
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
<img class="img-responsive" src="https://fakeimg.pl/365x245/" alt="img"></div>
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
<img class="img-responsive" src="https://fakeimg.pl/365x245/" alt="img"></div>
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
<img class="img-responsive" src="https://fakeimg.pl/365x245/" alt="img"></div>
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
<img class="img-responsive" src="https://fakeimg.pl/365x245/" alt="img"></div>
</div>
</div>
</div>
</body>
OK so gutters work for all columns under a row, so your html should be restructured like so, where are columns will be under a single row!
You cannot use gutters in bootstrap3
its only available in higher versions.
If you would like to stay on the same bootstrap version, please use my-3
instead of gy-3
, margins instead of gutters, if so you can have four columns in a single row also!
body {
margin: 0;
}
.gallery {
background-color: rgb(0, 0, 0);
max-height: 100%;
max-width: 100%;
}
<!DOCTYPE html>
<html lang="en">
<head>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<link rel="stylesheet" href="custom.css">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>title</title>
</head>
<body>
<div class="gallery" id="gallery">
<div class="container-fluid">
<div class="row gy-3">
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
<img class="img-responsive" src="https://fakeimg.pl/365x245/" alt="img"></div>
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
<img class="img-responsive" src="https://fakeimg.pl/365x245/" alt="img"></div>
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
<img class="img-responsive" src="https://fakeimg.pl/365x245/" alt="img"></div>
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
<img class="img-responsive" src="https://fakeimg.pl/365x245/" alt="img"></div>
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
<img class="img-responsive" src="https://fakeimg.pl/365x245/" alt="img"></div>
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
<img class="img-responsive" src="https://fakeimg.pl/365x245/" alt="img"></div>
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
<img class="img-responsive" src="https://fakeimg.pl/365x245/" alt="img"></div>
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
<img class="img-responsive" src="https://fakeimg.pl/365x245/" alt="img"></div>
</div>
</div>
</div>
</body>