Home > Blockchain >  How to fix gutters so they work properly?
How to fix gutters so they work properly?

Time:08-24

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/[email protected]/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  id="gallery">
  <div >
    <div >
      <div >
        <img  src="https://fakeimg.pl/365x245/" alt="img"></div>
      <div >
        <img  src="https://fakeimg.pl/365x245/" alt="img"></div>
      <div >
        <img  src="https://fakeimg.pl/365x245/" alt="img"></div>
      <div >
        <img  src="https://fakeimg.pl/365x245/" alt="img"></div>
</div>
    
    <div >
      <div >
        <img  src="https://fakeimg.pl/365x245/" alt="img"></div>
      <div >
        <img  src="https://fakeimg.pl/365x245/" alt="img"></div>
      <div >
        <img  src="https://fakeimg.pl/365x245/" alt="img"></div>
      <div >
        <img  src="https://fakeimg.pl/365x245/" alt="img"></div>
        
</div> 
</div> 
</div>
</body>

CodePudding user response:

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/[email protected]/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  id="gallery">
    <div >
      <div >
        <div >
          <img  src="https://fakeimg.pl/365x245/" alt="img"></div>
        <div >
          <img  src="https://fakeimg.pl/365x245/" alt="img"></div>
        <div >
          <img  src="https://fakeimg.pl/365x245/" alt="img"></div>
        <div >
          <img  src="https://fakeimg.pl/365x245/" alt="img"></div>
        <div >
          <img  src="https://fakeimg.pl/365x245/" alt="img"></div>
        <div >
          <img  src="https://fakeimg.pl/365x245/" alt="img"></div>
        <div >
          <img  src="https://fakeimg.pl/365x245/" alt="img"></div>
        <div >
          <img  src="https://fakeimg.pl/365x245/" alt="img"></div>
      </div>
    </div>
  </div>

</body>

  • Related