content logo

Bootstrap Grids:

Bootstrap Grids for Image Gallery & Preview

Many photographers and web designers are in search for a proper way to showcase their work and creativity. A great way to display your portfolio is to put up an online image gallery where people can enjoy your hard work and comment on it. it highlights some of the best works you had and can automatically attract clients for you.

In this post, we are sharing a code for a Bootstrap image gallery. This grid layout has simplistic and clean design. So, it is safe to assume that the visitors will not be distracted by any busy style element in your web design. They can focus entirely on the quality of your work which is the main goal here. These CSS image gallery grids template is extremely simple to use and can be customized to your heart’s content.

Also, this HTML image gallery template was designed professionally so all the necessary SEO features are already available inside the code. With the help of our Bootstrap image gallery effect grids, you can design a responsive image gallery and even add different effects to it to make it a bit livelier. Also, the code features an on-click preview system which enlarges the pictures whenever you click on them. This way you don’t have to open them separately in a new page.

#

Bootstrap Image Gallery

#

CSS Image Gallery Grids

#

HTML Image Gallery

#

Bootstrap Image Gallery Effect

<!-- This script got from frontendfreecode.com -->
<section id="gridGallery">
  <div class="container-fluid">
    <div class="row">
      <div class="col-sm-6 col-xs-6 box" id="boxOne">
        <div class="toggleIcon"></div>
        <div class="col-xs-6 captionBox hiddenText">
          <h3>Here is some text</h3>
          <p>Fixie banh mi blog, YOLO sriracha roof party mumblecore post-ironic. Keytar 90's cornhole drinking vinegar deep v, VHS messenger bag Pinterest. Etsy farm-to-table Intelligentsia Thundercats, pork belly vegan authentic single-origin coffee dreamcatcher
            bespoke master cleanse street art art party.</p>
          <p>Fixie banh mi blog, YOLO sriracha roof party mumblecore post-ironic. Keytar 90's cornhole drinking vinegar deep v, VHS messenger bag Pinterest. Etsy farm-to-table Intelligentsia Thundercats, pork belly vegan authentic single-origin coffee dreamcatcher
            bespoke master cleanse street art art party.</p>
        </div>
      </div>

      <div class="col-sm-3 col-xs-3 box" id="boxTwo">
        <div class="toggleIcon"></div>
        <div class="col-xs-6 captionBox hiddenText">
          <h3>Here is some text</h3>
          <p>Fixie banh mi blog, YOLO sriracha roof party mumblecore post-ironic. Keytar 90's cornhole drinking vinegar deep v, VHS messenger bag Pinterest. Etsy farm-to-table Intelligentsia Thundercats, pork belly vegan authentic single-origin coffee dreamcatcher
            bespoke master cleanse street art art party.</p>
        </div>

      </div>

      <div class="col-sm-3 col-xs-3 box" id="boxThree">
        <div class="toggleIcon"></div>
        <div class="col-xs-6 captionBox hiddenText">
          <h3>Here is some text</h3>
          <p>Fixie banh mi blog, YOLO sriracha roof party mumblecore post-ironic. Keytar 90's cornhole drinking vinegar deep v, VHS messenger bag Pinterest. Etsy farm-to-table Intelligentsia Thundercats, pork belly vegan authentic single-origin coffee dreamcatcher
            bespoke master cleanse street art art party.</p>
        </div>

      </div>

      <div class="col-sm-3 col-xs-3 box" id="boxFour">
        <div class="toggleIcon"></div>
        <div class="col-xs-6 captionBox hiddenText">
          <h3>Here is some text</h3>
          <p>Fixie banh mi blog, YOLO sriracha roof party mumblecore post-ironic. Keytar 90's cornhole drinking vinegar deep v, VHS messenger bag Pinterest. Etsy farm-to-table Intelligentsia Thundercats, pork belly vegan authentic single-origin coffee dreamcatcher
            bespoke master cleanse street art art party.</p>
        </div>

      </div>

      <div class="col-sm-6 col-xs-6 pull-right box" id="boxEight">
        <div class="toggleIcon"></div>
        <div class="col-xs-6 captionBox hiddenText">
          <h3>Here is some text</h3>
          <p>Fixie banh mi blog, YOLO sriracha roof party mumblecore post-ironic. Keytar 90's cornhole drinking vinegar deep v, VHS messenger bag Pinterest. Etsy farm-to-table Intelligentsia Thundercats, pork belly vegan authentic single-origin coffee dreamcatcher
            bespoke master cleanse street art art party.</p>
        </div>

      </div>

      <div class="col-sm-3 col-xs-3 pull-right box" id="boxSeven">
        <div class="toggleIcon"></div>
        <div class="col-xs-6 captionBox hiddenText">
          <h3>Here is some text</h3>
          <p>Fixie banh mi blog, YOLO sriracha roof party mumblecore post-ironic. Keytar 90's cornhole drinking vinegar deep v, VHS messenger bag Pinterest. Etsy farm-to-table Intelligentsia Thundercats, pork belly vegan authentic single-origin coffee dreamcatcher
            bespoke master cleanse street art art party.</p>
        </div>

      </div>

      <div class="col-sm-3 col-xs-3 box" id="boxFive">
        <div class="toggleIcon"></div>
        <div class="col-xs-6 captionBox hiddenText bottomRight">
          <h3>Here is some text</h3>
          <p>Fixie banh mi blog, YOLO sriracha roof party mumblecore post-ironic. Keytar 90's cornhole drinking vinegar deep v, VHS messenger bag Pinterest. Etsy farm-to-table Intelligentsia Thundercats, pork belly vegan authentic single-origin coffee dreamcatcher
            bespoke master cleanse street art art party.</p>
        </div>

      </div>

      <div class="col-sm-3 col-xs-3 box" id="boxSix">
        <div class="toggleIcon"></div>
        <div class="col-xs-6 captionBox hiddenText bottomRight">
          <h3>Here is some text</h3>
          <p>Fixie banh mi blog, YOLO sriracha roof party mumblecore post-ironic. Keytar 90's cornhole drinking vinegar deep v, VHS messenger bag Pinterest. Etsy farm-to-table Intelligentsia Thundercats, pork belly vegan authentic single-origin coffee dreamcatcher
            bespoke master cleanse street art art party.</p>
        </div>

      </div>


    </div>
    <!--.row-->

  </div>
  <!--.container-->

</section><a style="font-size: 8pt; text-decoration: none" target="_blank" href="http://frontendfreecode.com">Free Frontend</a>
                                                                            
body {
  font-family: 'Source Sans Pro', sans-serif;
}

#gridGallery {
  max-width: 1170px;
  margin-left: auto;
  margin-right: auto;
}

h2,
  .ms-WPBody h2 {
  color: #000;
}

.box h3 {
  color: #fff;
  font-family: 'Source Sans Pro';
  font-weight:700;
}

section {
  margin: 25px 0;
}

#gridGallery .row {
  background-color: black;
}

.box {
  background-position: center center;
  background-size: cover;
  border: 1px solid #fff;
  transition: opacity .25s;
  overflow: hidden;
}

.hiddenText {
  display: none !important;
}

.box:hover {
  cursor: pointer;
  z-index: 1;
}

#boxOne,
#boxTwo,
#boxSeven,
#boxEight {
  height: 300px;
}

#boxThree,
#boxFour,
#boxFive,
#boxSix {
  height: 150px;
}

#boxOne {
  background-image: url('http://frontendfreecode.com/codes/files/imageOne.jpg');
}

#boxEight {
  background-image: url('http://frontendfreecode.com/codes/files/imageEight.jpg');
}

#boxTwo {
  background-image: url('http://frontendfreecode.com/codes/files/imageTwo.jpg');
}

#boxSeven {
  background-image: url('http://frontendfreecode.com/codes/files/imageSeven.jpg');
}

#boxThree {
  background-image: url('http://frontendfreecode.com/codes/files/imageThree.jpg');
}

#boxSix {
  background-image: url('http://frontendfreecode.com/codes/files/imageSix.jpg');
}

#boxFour {
  background-image: url('http://frontendfreecode.com/codes/files/imageFour.jpg');
}

#boxFive {
  background-image: url('http://frontendfreecode.com/codes/files/imageFive.jpg');
}

.full {
  float: none;
  height: 600px !important;
  width: 1170px;
  position: absolute;
  z-index: 2;
}

#gridH {
  background-color: #eee;
  min-height: 600px;
  margin-bottom: 50px;
}

#gridH .row {
  margin-top: 150px;
}

#gridH .row .full {
  margin-top: -150px;
}

.full:hover {
  transform: scale(1);
  box-shadow: none;
}

.opacity {
  opacity: .8;
}

.captionBox {
  background-color: rgba(0, 0, 0, 0.8);
  bottom: 50px;
  color: white;
  left: 50px;
  padding: 25px;
  position: absolute;
  opacity: 0;
}

.captionBox p {
  font-size: 16px;
  font-weight:300;
}

.captionBox h3 {
  margin-top: 0;
  text-transform: uppercase;
}

.transition {
  transition: 1s;
}

.bottomRight {
  left: auto;
  right: 80px;
}

.topRight {
  left: auto;
  right: 50px;
  bottom: auto;
  top: 50px;
}

.topLeft {
  bottom: auto;
  top: 50px;
}

.toggleIcon {
  background-color: rgba(0, 0, 0, 0.7);
  background-position: center center;
  background-repeat: no-repeat;
  background-size: 26px 26px;
  border-radius: 3px;
  bottom: 15px;
  height: 36px;
  left: -100px;
  opacity: 0;
  padding: 10px;
  position: absolute;
  width: 36px;
}

.box.full .toggleIcon {
  background-color: rgba(0, 0, 0, 0.57);
  background-position: center center;
  background-repeat: no-repeat;
  border-radius: 3px;
  top: 26px;
  height: 36px;
  left: 50px;
  opacity: 0;
  padding: 10px;
  position: absolute;
  width: 36px;
}

.box:hover .toggleIcon {
  opacity: 1;
  left: 15px;
  transition: all 0.25s ease 0s;
  background-image: url('http://frontendfreecode.com/codes/files/openIcon.png');
}

.box.full .toggleIcon {
  opacity: 1;
  left: 50px;
  top: 26px;
  border-radius: 0;
  background-image: url('http://frontendfreecode.com/codes/files/closeIcon.png');
  background-size: 55%;
}

.box.full .toggleIcon:hover {
  background-color: black;
  transition: all 0s ease 0;
}

#gridGallery > .row {
  margin: 0;
}

@media (max-width: 1200px) {
  .full {
	width: 970px;
  }
}

@media (max-width: 992px) {
  .full {
	width: 750px;
  }
}

@media (max-width: 768px) {
  #boxThree,
  #boxFour,
  #boxFive,
  #boxSix {
	height: 300px;
  }
  .toggleIcon {
	display: none;
  }
  .full .captionBox {
	bottom: 0;
	left: 0;
	position: absolute;
	width: 100%;
	padding: 10px;
  }
  .full .captionBox p {
	display: none;
  }
  .full .captionBox h3 {
	margin-bottom: 0;
  }
  .box.full {
	height: inherit;
	width: 100%;
  }
  .box {
	max-height: 150px !important;
  }
  #gridGallery .row {
	background-color: transparent;
  }
  #gridH .row {
	margin-top: 0px;
  }
  .box.full .toggleIcon {
	height: 50px !important;
	left: 0 !important;
	top: 0 !important;
	width: 50px !important;
	display: block;
  }
  .mobileFunction {
	float: left;
	height: 150px;
	width: 100%;
  }
  /* SHAREPOINT ONLY */
}
$(document).ready(function () {

  $(".box").on("click", function () {
    $(this).siblings().toggleClass("hidden");
    $(this).toggleClass("full");
    $(".captionBox").toggleClass("hiddenText");
    $(this).children().animate({
      opacity: "1" },
    500, function () {});
  });

  if ($(window).width() < 768) {
    $(".box").on("click", function () {
      $("#gridGallery").toggleClass("mobileFunction");
    });
  }

  if ($(window).width() >= 768) {

    $(".box").hover(function () {
      $(this).siblings().toggleClass("opacity");
    });

  }

  $(".horizontal").click(function () {
    $(this).toggleClass("full");
    $(".captionBox").toggleClass("hiddenText");
    $(this).children().animate({
      opacity: "1" },
    500, function () {});
  });

  $(".horizontal").hover(function () {
    $(this).siblings().toggleClass("opacity");
  });

});
<link rel='stylesheet' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css'>
<link rel='stylesheet' href='https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,200,300,700'>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- This script got from frontendfreecode.com -->

<link rel='stylesheet' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css'>
<link rel='stylesheet' href='https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,200,300,700'>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<style>
body {
  font-family: 'Source Sans Pro', sans-serif;
}

#gridGallery {
  max-width: 1170px;
  margin-left: auto;
  margin-right: auto;
}

h2,
  .ms-WPBody h2 {
  color: #000;
}

.box h3 {
  color: #fff;
  font-family: 'Source Sans Pro';
  font-weight:700;
}

section {
  margin: 25px 0;
}

#gridGallery .row {
  background-color: black;
}

.box {
  background-position: center center;
  background-size: cover;
  border: 1px solid #fff;
  transition: opacity .25s;
  overflow: hidden;
}

.hiddenText {
  display: none !important;
}

.box:hover {
  cursor: pointer;
  z-index: 1;
}

#boxOne,
#boxTwo,
#boxSeven,
#boxEight {
  height: 300px;
}

#boxThree,
#boxFour,
#boxFive,
#boxSix {
  height: 150px;
}

#boxOne {
  background-image: url('http://frontendfreecode.com/codes/files/imageOne.jpg');
}

#boxEight {
  background-image: url('http://frontendfreecode.com/codes/files/imageEight.jpg');
}

#boxTwo {
  background-image: url('http://frontendfreecode.com/codes/files/imageTwo.jpg');
}

#boxSeven {
  background-image: url('http://frontendfreecode.com/codes/files/imageSeven.jpg');
}

#boxThree {
  background-image: url('http://frontendfreecode.com/codes/files/imageThree.jpg');
}

#boxSix {
  background-image: url('http://frontendfreecode.com/codes/files/imageSix.jpg');
}

#boxFour {
  background-image: url('http://frontendfreecode.com/codes/files/imageFour.jpg');
}

#boxFive {
  background-image: url('http://frontendfreecode.com/codes/files/imageFive.jpg');
}

.full {
  float: none;
  height: 600px !important;
  width: 1170px;
  position: absolute;
  z-index: 2;
}

#gridH {
  background-color: #eee;
  min-height: 600px;
  margin-bottom: 50px;
}

#gridH .row {
  margin-top: 150px;
}

#gridH .row .full {
  margin-top: -150px;
}

.full:hover {
  transform: scale(1);
  box-shadow: none;
}

.opacity {
  opacity: .8;
}

.captionBox {
  background-color: rgba(0, 0, 0, 0.8);
  bottom: 50px;
  color: white;
  left: 50px;
  padding: 25px;
  position: absolute;
  opacity: 0;
}

.captionBox p {
  font-size: 16px;
  font-weight:300;
}

.captionBox h3 {
  margin-top: 0;
  text-transform: uppercase;
}

.transition {
  transition: 1s;
}

.bottomRight {
  left: auto;
  right: 80px;
}

.topRight {
  left: auto;
  right: 50px;
  bottom: auto;
  top: 50px;
}

.topLeft {
  bottom: auto;
  top: 50px;
}

.toggleIcon {
  background-color: rgba(0, 0, 0, 0.7);
  background-position: center center;
  background-repeat: no-repeat;
  background-size: 26px 26px;
  border-radius: 3px;
  bottom: 15px;
  height: 36px;
  left: -100px;
  opacity: 0;
  padding: 10px;
  position: absolute;
  width: 36px;
}

.box.full .toggleIcon {
  background-color: rgba(0, 0, 0, 0.57);
  background-position: center center;
  background-repeat: no-repeat;
  border-radius: 3px;
  top: 26px;
  height: 36px;
  left: 50px;
  opacity: 0;
  padding: 10px;
  position: absolute;
  width: 36px;
}

.box:hover .toggleIcon {
  opacity: 1;
  left: 15px;
  transition: all 0.25s ease 0s;
  background-image: url('http://frontendfreecode.com/codes/files/openIcon.png');
}

.box.full .toggleIcon {
  opacity: 1;
  left: 50px;
  top: 26px;
  border-radius: 0;
  background-image: url('http://frontendfreecode.com/codes/files/closeIcon.png');
  background-size: 55%;
}

.box.full .toggleIcon:hover {
  background-color: black;
  transition: all 0s ease 0;
}

#gridGallery > .row {
  margin: 0;
}

@media (max-width: 1200px) {
  .full {
	width: 970px;
  }
}

@media (max-width: 992px) {
  .full {
	width: 750px;
  }
}

@media (max-width: 768px) {
  #boxThree,
  #boxFour,
  #boxFive,
  #boxSix {
	height: 300px;
  }
  .toggleIcon {
	display: none;
  }
  .full .captionBox {
	bottom: 0;
	left: 0;
	position: absolute;
	width: 100%;
	padding: 10px;
  }
  .full .captionBox p {
	display: none;
  }
  .full .captionBox h3 {
	margin-bottom: 0;
  }
  .box.full {
	height: inherit;
	width: 100%;
  }
  .box {
	max-height: 150px !important;
  }
  #gridGallery .row {
	background-color: transparent;
  }
  #gridH .row {
	margin-top: 0px;
  }
  .box.full .toggleIcon {
	height: 50px !important;
	left: 0 !important;
	top: 0 !important;
	width: 50px !important;
	display: block;
  }
  .mobileFunction {
	float: left;
	height: 150px;
	width: 100%;
  }
  /* SHAREPOINT ONLY */
}

</style>

</head>
<body>
<section id="gridGallery">
  <div class="container-fluid">
    <div class="row">
      <div class="col-sm-6 col-xs-6 box" id="boxOne">
        <div class="toggleIcon"></div>
        <div class="col-xs-6 captionBox hiddenText">
          <h3>Here is some text</h3>
          <p>Fixie banh mi blog, YOLO sriracha roof party mumblecore post-ironic. Keytar 90's cornhole drinking vinegar deep v, VHS messenger bag Pinterest. Etsy farm-to-table Intelligentsia Thundercats, pork belly vegan authentic single-origin coffee dreamcatcher
            bespoke master cleanse street art art party.</p>
          <p>Fixie banh mi blog, YOLO sriracha roof party mumblecore post-ironic. Keytar 90's cornhole drinking vinegar deep v, VHS messenger bag Pinterest. Etsy farm-to-table Intelligentsia Thundercats, pork belly vegan authentic single-origin coffee dreamcatcher
            bespoke master cleanse street art art party.</p>
        </div>
      </div>

      <div class="col-sm-3 col-xs-3 box" id="boxTwo">
        <div class="toggleIcon"></div>
        <div class="col-xs-6 captionBox hiddenText">
          <h3>Here is some text</h3>
          <p>Fixie banh mi blog, YOLO sriracha roof party mumblecore post-ironic. Keytar 90's cornhole drinking vinegar deep v, VHS messenger bag Pinterest. Etsy farm-to-table Intelligentsia Thundercats, pork belly vegan authentic single-origin coffee dreamcatcher
            bespoke master cleanse street art art party.</p>
        </div>

      </div>

      <div class="col-sm-3 col-xs-3 box" id="boxThree">
        <div class="toggleIcon"></div>
        <div class="col-xs-6 captionBox hiddenText">
          <h3>Here is some text</h3>
          <p>Fixie banh mi blog, YOLO sriracha roof party mumblecore post-ironic. Keytar 90's cornhole drinking vinegar deep v, VHS messenger bag Pinterest. Etsy farm-to-table Intelligentsia Thundercats, pork belly vegan authentic single-origin coffee dreamcatcher
            bespoke master cleanse street art art party.</p>
        </div>

      </div>

      <div class="col-sm-3 col-xs-3 box" id="boxFour">
        <div class="toggleIcon"></div>
        <div class="col-xs-6 captionBox hiddenText">
          <h3>Here is some text</h3>
          <p>Fixie banh mi blog, YOLO sriracha roof party mumblecore post-ironic. Keytar 90's cornhole drinking vinegar deep v, VHS messenger bag Pinterest. Etsy farm-to-table Intelligentsia Thundercats, pork belly vegan authentic single-origin coffee dreamcatcher
            bespoke master cleanse street art art party.</p>
        </div>

      </div>

      <div class="col-sm-6 col-xs-6 pull-right box" id="boxEight">
        <div class="toggleIcon"></div>
        <div class="col-xs-6 captionBox hiddenText">
          <h3>Here is some text</h3>
          <p>Fixie banh mi blog, YOLO sriracha roof party mumblecore post-ironic. Keytar 90's cornhole drinking vinegar deep v, VHS messenger bag Pinterest. Etsy farm-to-table Intelligentsia Thundercats, pork belly vegan authentic single-origin coffee dreamcatcher
            bespoke master cleanse street art art party.</p>
        </div>

      </div>

      <div class="col-sm-3 col-xs-3 pull-right box" id="boxSeven">
        <div class="toggleIcon"></div>
        <div class="col-xs-6 captionBox hiddenText">
          <h3>Here is some text</h3>
          <p>Fixie banh mi blog, YOLO sriracha roof party mumblecore post-ironic. Keytar 90's cornhole drinking vinegar deep v, VHS messenger bag Pinterest. Etsy farm-to-table Intelligentsia Thundercats, pork belly vegan authentic single-origin coffee dreamcatcher
            bespoke master cleanse street art art party.</p>
        </div>

      </div>

      <div class="col-sm-3 col-xs-3 box" id="boxFive">
        <div class="toggleIcon"></div>
        <div class="col-xs-6 captionBox hiddenText bottomRight">
          <h3>Here is some text</h3>
          <p>Fixie banh mi blog, YOLO sriracha roof party mumblecore post-ironic. Keytar 90's cornhole drinking vinegar deep v, VHS messenger bag Pinterest. Etsy farm-to-table Intelligentsia Thundercats, pork belly vegan authentic single-origin coffee dreamcatcher
            bespoke master cleanse street art art party.</p>
        </div>

      </div>

      <div class="col-sm-3 col-xs-3 box" id="boxSix">
        <div class="toggleIcon"></div>
        <div class="col-xs-6 captionBox hiddenText bottomRight">
          <h3>Here is some text</h3>
          <p>Fixie banh mi blog, YOLO sriracha roof party mumblecore post-ironic. Keytar 90's cornhole drinking vinegar deep v, VHS messenger bag Pinterest. Etsy farm-to-table Intelligentsia Thundercats, pork belly vegan authentic single-origin coffee dreamcatcher
            bespoke master cleanse street art art party.</p>
        </div>

      </div>


    </div>
    <!--.row-->

  </div>
  <!--.container-->

</section><div id="bcl"><a style="font-size:8pt;text-decoration:none;" href="http://www.devanswer.com">Free Frontend</a></div>
<script>
$(document).ready(function () {

  $(".box").on("click", function () {
    $(this).siblings().toggleClass("hidden");
    $(this).toggleClass("full");
    $(".captionBox").toggleClass("hiddenText");
    $(this).children().animate({
      opacity: "1" },
    500, function () {});
  });

  if ($(window).width() < 768) {
    $(".box").on("click", function () {
      $("#gridGallery").toggleClass("mobileFunction");
    });
  }

  if ($(window).width() >= 768) {

    $(".box").hover(function () {
      $(this).siblings().toggleClass("opacity");
    });

  }

  $(".horizontal").click(function () {
    $(this).toggleClass("full");
    $(".captionBox").toggleClass("hiddenText");
    $(this).children().animate({
      opacity: "1" },
    500, function () {});
  });

  $(".horizontal").hover(function () {
    $(this).siblings().toggleClass("opacity");
  });

});
</script>

</body>
</html>
Preview