html - Gallery display horizontally with images with the same size -


i'm working on html , css , i'm having hard time aligning images horizontally instead of vertically.

i tried displaying them inline-block , inline none of them works. , want images have same sizes.

here's html code:

#gallery {    width: 500px;    overflow: hidden;    position: relative;    z-index: 1;    margin: 100px auto;    display: inline;  }    #gallery img {    width: 50%;    height: auto;    border: 5px solid #ffffff;    margin: 10px;    box-sizing: border-box;    margin: 0 auto;    padding: 0;  }
<div id="gallery">    <a href="images/gallery1.png" data-lightbox="image-1" data-title="ian , vee"><img src="images/gallery1.png"></a>    <a href="images/gallery2.png" data-lightbox="roadtrip" data-title="ian , vee"><img src="images/gallery2.png"></a>    <a href="images/gallery3.png" data-lightbox="roadtrip" data-title="ian , vee"><img src="images/gallery3.png"></a>    <a href="images/gallery4.png" data-lightbox="roadtrip" data-title="ian , vee"><img src="images/gallery4.png"></a>    <a href="images/gallery5.png" data-lightbox="roadtrip" data-title="ian , vee"><img src="images/gallery5.png"></a>    <a href="images/gallery6.png" data-lightbox="roadtrip" data-title="ian , vee"><img src="images/gallery6.png"></a>    <script src="lightbox2-master/dist/js/lightbox-plus-jquery.js"></script>  </div>

try this:

div.gallery {    margin: 5px;    border: 1px solid #ccc;    float: left;    width: 180px;  }    div.gallery:hover {    border: 1px solid #777;  }    div.gallery img {    width: 100%;    height: auto;  }    div.desc {    padding: 15px;    text-align: center;  }
<div class="gallery">    <a href="images/gallery1.png" data-lightbox="image-1" data-title="ian , vee">      <img src="images/gallery1.png" width="600" height="400">    </a>  </div>  <div class="gallery">    <a href="images/gallery1.png" data-lightbox="image-1" data-title="ian , vee">      <img src="images/gallery1.png" width="600" height="400">    </a>  </div>  <div class="gallery">    <a href="images/gallery1.png" data-lightbox="image-1" data-title="ian , vee">      <img src="images/gallery1.png" width="600" height="400">    </a>  </div>  <div class="gallery">    <a href="images/gallery1.png" data-lightbox="image-1" data-title="ian , vee">      <img src="images/gallery1.png" width="600" height="400">    </a>  </div>  <div class="gallery">    <a href="images/gallery1.png" data-lightbox="image-1" data-title="ian , vee">      <img src="images/gallery1.png" width="600" height="400">    </a>  </div>  <div class="gallery">    <a href="images/gallery1.png" data-lightbox="image-1" data-title="ian , vee">      <img src="images/gallery1.png" width="600" height="400">    </a>  </div>


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -