Make images be closer to each other











up vote
1
down vote

favorite












I currently have this code






div {
background-color: indigo;
}

.shirt-container img {
height: 225px;
position: relative;
z-index: 3;
}

.all-shirts-wrapper {
display: flex;
/* width: 41px; */
}

.shirt-container {
position: relative;
}

<div class="all-shirts-wrapper">
<div class="shirt-container"><img src="http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-classic-short-sleeve-tee.png"></div>
<div class="shirt-container"><img src="http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-pullover-hoodie.png"></div>
<div class="shirt-container"><img src="http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_womens-premium-semi-fitted-v-neck.png"></div>
</div>





What I want to achieve is below (image). As you can see, I would like the images to be closer to each other.
enter image description here




Below is my sad attempt of trying to achieve the result






div {
background-color: indigo;
}

.shirt-container img {
height: 225px;
position: relative;
z-index: 3;
}

.all-shirts-wrapper {
display: flex;
/* width: 41px; */
}

.shirt-container {
width: 140px;
position: relative;
}

<div class="all-shirts-wrapper">
<div class="shirt-container"><img src="http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-classic-short-sleeve-tee.png"></div>
<div class="shirt-container"><img src="http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-pullover-hoodie.png"></div>
<div class="shirt-container"><img src="http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_womens-premium-semi-fitted-v-neck.png"></div>
</div>





For specific reasons, I cannot crop the images



Here is the fiddle: https://jsfiddle.net/bhz3kLfj/










share|improve this question




























    up vote
    1
    down vote

    favorite












    I currently have this code






    div {
    background-color: indigo;
    }

    .shirt-container img {
    height: 225px;
    position: relative;
    z-index: 3;
    }

    .all-shirts-wrapper {
    display: flex;
    /* width: 41px; */
    }

    .shirt-container {
    position: relative;
    }

    <div class="all-shirts-wrapper">
    <div class="shirt-container"><img src="http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-classic-short-sleeve-tee.png"></div>
    <div class="shirt-container"><img src="http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-pullover-hoodie.png"></div>
    <div class="shirt-container"><img src="http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_womens-premium-semi-fitted-v-neck.png"></div>
    </div>





    What I want to achieve is below (image). As you can see, I would like the images to be closer to each other.
    enter image description here




    Below is my sad attempt of trying to achieve the result






    div {
    background-color: indigo;
    }

    .shirt-container img {
    height: 225px;
    position: relative;
    z-index: 3;
    }

    .all-shirts-wrapper {
    display: flex;
    /* width: 41px; */
    }

    .shirt-container {
    width: 140px;
    position: relative;
    }

    <div class="all-shirts-wrapper">
    <div class="shirt-container"><img src="http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-classic-short-sleeve-tee.png"></div>
    <div class="shirt-container"><img src="http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-pullover-hoodie.png"></div>
    <div class="shirt-container"><img src="http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_womens-premium-semi-fitted-v-neck.png"></div>
    </div>





    For specific reasons, I cannot crop the images



    Here is the fiddle: https://jsfiddle.net/bhz3kLfj/










    share|improve this question


























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I currently have this code






      div {
      background-color: indigo;
      }

      .shirt-container img {
      height: 225px;
      position: relative;
      z-index: 3;
      }

      .all-shirts-wrapper {
      display: flex;
      /* width: 41px; */
      }

      .shirt-container {
      position: relative;
      }

      <div class="all-shirts-wrapper">
      <div class="shirt-container"><img src="http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-classic-short-sleeve-tee.png"></div>
      <div class="shirt-container"><img src="http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-pullover-hoodie.png"></div>
      <div class="shirt-container"><img src="http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_womens-premium-semi-fitted-v-neck.png"></div>
      </div>





      What I want to achieve is below (image). As you can see, I would like the images to be closer to each other.
      enter image description here




      Below is my sad attempt of trying to achieve the result






      div {
      background-color: indigo;
      }

      .shirt-container img {
      height: 225px;
      position: relative;
      z-index: 3;
      }

      .all-shirts-wrapper {
      display: flex;
      /* width: 41px; */
      }

      .shirt-container {
      width: 140px;
      position: relative;
      }

      <div class="all-shirts-wrapper">
      <div class="shirt-container"><img src="http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-classic-short-sleeve-tee.png"></div>
      <div class="shirt-container"><img src="http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-pullover-hoodie.png"></div>
      <div class="shirt-container"><img src="http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_womens-premium-semi-fitted-v-neck.png"></div>
      </div>





      For specific reasons, I cannot crop the images



      Here is the fiddle: https://jsfiddle.net/bhz3kLfj/










      share|improve this question















      I currently have this code






      div {
      background-color: indigo;
      }

      .shirt-container img {
      height: 225px;
      position: relative;
      z-index: 3;
      }

      .all-shirts-wrapper {
      display: flex;
      /* width: 41px; */
      }

      .shirt-container {
      position: relative;
      }

      <div class="all-shirts-wrapper">
      <div class="shirt-container"><img src="http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-classic-short-sleeve-tee.png"></div>
      <div class="shirt-container"><img src="http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-pullover-hoodie.png"></div>
      <div class="shirt-container"><img src="http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_womens-premium-semi-fitted-v-neck.png"></div>
      </div>





      What I want to achieve is below (image). As you can see, I would like the images to be closer to each other.
      enter image description here




      Below is my sad attempt of trying to achieve the result






      div {
      background-color: indigo;
      }

      .shirt-container img {
      height: 225px;
      position: relative;
      z-index: 3;
      }

      .all-shirts-wrapper {
      display: flex;
      /* width: 41px; */
      }

      .shirt-container {
      width: 140px;
      position: relative;
      }

      <div class="all-shirts-wrapper">
      <div class="shirt-container"><img src="http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-classic-short-sleeve-tee.png"></div>
      <div class="shirt-container"><img src="http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-pullover-hoodie.png"></div>
      <div class="shirt-container"><img src="http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_womens-premium-semi-fitted-v-neck.png"></div>
      </div>





      For specific reasons, I cannot crop the images



      Here is the fiddle: https://jsfiddle.net/bhz3kLfj/






      div {
      background-color: indigo;
      }

      .shirt-container img {
      height: 225px;
      position: relative;
      z-index: 3;
      }

      .all-shirts-wrapper {
      display: flex;
      /* width: 41px; */
      }

      .shirt-container {
      position: relative;
      }

      <div class="all-shirts-wrapper">
      <div class="shirt-container"><img src="http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-classic-short-sleeve-tee.png"></div>
      <div class="shirt-container"><img src="http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-pullover-hoodie.png"></div>
      <div class="shirt-container"><img src="http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_womens-premium-semi-fitted-v-neck.png"></div>
      </div>





      div {
      background-color: indigo;
      }

      .shirt-container img {
      height: 225px;
      position: relative;
      z-index: 3;
      }

      .all-shirts-wrapper {
      display: flex;
      /* width: 41px; */
      }

      .shirt-container {
      position: relative;
      }

      <div class="all-shirts-wrapper">
      <div class="shirt-container"><img src="http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-classic-short-sleeve-tee.png"></div>
      <div class="shirt-container"><img src="http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-pullover-hoodie.png"></div>
      <div class="shirt-container"><img src="http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_womens-premium-semi-fitted-v-neck.png"></div>
      </div>





      div {
      background-color: indigo;
      }

      .shirt-container img {
      height: 225px;
      position: relative;
      z-index: 3;
      }

      .all-shirts-wrapper {
      display: flex;
      /* width: 41px; */
      }

      .shirt-container {
      width: 140px;
      position: relative;
      }

      <div class="all-shirts-wrapper">
      <div class="shirt-container"><img src="http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-classic-short-sleeve-tee.png"></div>
      <div class="shirt-container"><img src="http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-pullover-hoodie.png"></div>
      <div class="shirt-container"><img src="http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_womens-premium-semi-fitted-v-neck.png"></div>
      </div>





      div {
      background-color: indigo;
      }

      .shirt-container img {
      height: 225px;
      position: relative;
      z-index: 3;
      }

      .all-shirts-wrapper {
      display: flex;
      /* width: 41px; */
      }

      .shirt-container {
      width: 140px;
      position: relative;
      }

      <div class="all-shirts-wrapper">
      <div class="shirt-container"><img src="http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-classic-short-sleeve-tee.png"></div>
      <div class="shirt-container"><img src="http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-pullover-hoodie.png"></div>
      <div class="shirt-container"><img src="http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_womens-premium-semi-fitted-v-neck.png"></div>
      </div>






      html css






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 9 at 4:15

























      asked Nov 9 at 4:00









      eric

      5611




      5611
























          4 Answers
          4






          active

          oldest

          votes

















          up vote
          1
          down vote



          accepted










          Use image as background like this.






          div {
          background-color: indigo;
          }

          .shirt-container img {
          height: 225px;
          position: relative;
          z-index: 3;
          }

          .all-shirts-wrapper {
          display: flex;
          /* width: 41px; */
          }

          .shirt-container {
          width: 150px;
          height: 200px;
          position: relative;
          background-size: 200px auto;
          background-repeat: no-repeat;
          background-position: center;
          }

          <div class="all-shirts-wrapper">
          <div class="shirt-container" style="background-image:url('http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-classic-short-sleeve-tee.png')"></div>
          <div class="shirt-container" style="background-image:url('http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-pullover-hoodie.png')"></div>
          <div class="shirt-container" style="background-image:url('http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_womens-premium-semi-fitted-v-neck.png')"></div>

          </div>








          share|improve this answer




























            up vote
            1
            down vote













            You can use object-fit: cover to crop the images from left and right at the width you want (there the images are 225px wide, so let's make them at a width of 170px to remove most of the blanks left and right)



            See Fiddle






            share|improve this answer





















            • Yes, this is another option, make sure to check browser support before using caniuse.com/#search=object-fit
              – kiranvj
              Nov 9 at 4:32


















            up vote
            1
            down vote













            Here's my solution:






            div {
            background-color: indigo;
            }

            .shirt-container img {
            height: 225px;
            position: absolute;
            z-index: 3;
            left: 50%;
            transform: translateX(-50%);
            }

            .all-shirts-wrapper {
            display: flex;
            /* width: 41px; */
            }

            .shirt-container {
            width: 160px;
            height: 225px;
            position: relative;
            overflow: hidden;
            }

            <div class="all-shirts-wrapper">
            <div class="shirt-container"><img src="http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-classic-short-sleeve-tee.png"></div>
            <div class="shirt-container"><img src="http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-pullover-hoodie.png"></div>
            <div class="shirt-container"><img src="http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_womens-premium-semi-fitted-v-neck.png"></div>
            </div>








            share|improve this answer




























              up vote
              0
              down vote













              You could try adding the images as a background to each div. That may allow you to eliminate the white space to the right and left of each image.



              <div class="all-shirts-wrapper">
              <div class="shirt-container" style="background-image: url(http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-classic-short-sleeve-tee.png)"></div>
              <div class="shirt-container" style="background-image: url(http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-pullover-hoodie.png)"></div>
              <div class="shirt-container" style="background-image: url(http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_womens-premium-semi-fitted-v-neck.png)"></div>
              </div>

              div {
              background-color: indigo;
              }
              .shirt-container {background-size:contain; background-repeat: no-repeat;}

              .shirt-container img {
              height: 225px;
              position: relative;
              z-index: 3;
              }

              .all-shirts-wrapper {
              display: flex;
              /* width: 41px; */
              height: 200px;
              }

              .shirt-container {
              width: 140px;
              position: relative;
              }


              https://jsfiddle.net/uxwnkets/






              share|improve this answer





















                Your Answer






                StackExchange.ifUsing("editor", function () {
                StackExchange.using("externalEditor", function () {
                StackExchange.using("snippets", function () {
                StackExchange.snippets.init();
                });
                });
                }, "code-snippets");

                StackExchange.ready(function() {
                var channelOptions = {
                tags: "".split(" "),
                id: "1"
                };
                initTagRenderer("".split(" "), "".split(" "), channelOptions);

                StackExchange.using("externalEditor", function() {
                // Have to fire editor after snippets, if snippets enabled
                if (StackExchange.settings.snippets.snippetsEnabled) {
                StackExchange.using("snippets", function() {
                createEditor();
                });
                }
                else {
                createEditor();
                }
                });

                function createEditor() {
                StackExchange.prepareEditor({
                heartbeatType: 'answer',
                convertImagesToLinks: true,
                noModals: true,
                showLowRepImageUploadWarning: true,
                reputationToPostImages: 10,
                bindNavPrevention: true,
                postfix: "",
                imageUploader: {
                brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                allowUrls: true
                },
                onDemand: true,
                discardSelector: ".discard-answer"
                ,immediatelyShowMarkdownHelp:true
                });


                }
                });














                draft saved

                draft discarded


















                StackExchange.ready(
                function () {
                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53219692%2fmake-images-be-closer-to-each-other%23new-answer', 'question_page');
                }
                );

                Post as a guest















                Required, but never shown

























                4 Answers
                4






                active

                oldest

                votes








                4 Answers
                4






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes








                up vote
                1
                down vote



                accepted










                Use image as background like this.






                div {
                background-color: indigo;
                }

                .shirt-container img {
                height: 225px;
                position: relative;
                z-index: 3;
                }

                .all-shirts-wrapper {
                display: flex;
                /* width: 41px; */
                }

                .shirt-container {
                width: 150px;
                height: 200px;
                position: relative;
                background-size: 200px auto;
                background-repeat: no-repeat;
                background-position: center;
                }

                <div class="all-shirts-wrapper">
                <div class="shirt-container" style="background-image:url('http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-classic-short-sleeve-tee.png')"></div>
                <div class="shirt-container" style="background-image:url('http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-pullover-hoodie.png')"></div>
                <div class="shirt-container" style="background-image:url('http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_womens-premium-semi-fitted-v-neck.png')"></div>

                </div>








                share|improve this answer

























                  up vote
                  1
                  down vote



                  accepted










                  Use image as background like this.






                  div {
                  background-color: indigo;
                  }

                  .shirt-container img {
                  height: 225px;
                  position: relative;
                  z-index: 3;
                  }

                  .all-shirts-wrapper {
                  display: flex;
                  /* width: 41px; */
                  }

                  .shirt-container {
                  width: 150px;
                  height: 200px;
                  position: relative;
                  background-size: 200px auto;
                  background-repeat: no-repeat;
                  background-position: center;
                  }

                  <div class="all-shirts-wrapper">
                  <div class="shirt-container" style="background-image:url('http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-classic-short-sleeve-tee.png')"></div>
                  <div class="shirt-container" style="background-image:url('http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-pullover-hoodie.png')"></div>
                  <div class="shirt-container" style="background-image:url('http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_womens-premium-semi-fitted-v-neck.png')"></div>

                  </div>








                  share|improve this answer























                    up vote
                    1
                    down vote



                    accepted







                    up vote
                    1
                    down vote



                    accepted






                    Use image as background like this.






                    div {
                    background-color: indigo;
                    }

                    .shirt-container img {
                    height: 225px;
                    position: relative;
                    z-index: 3;
                    }

                    .all-shirts-wrapper {
                    display: flex;
                    /* width: 41px; */
                    }

                    .shirt-container {
                    width: 150px;
                    height: 200px;
                    position: relative;
                    background-size: 200px auto;
                    background-repeat: no-repeat;
                    background-position: center;
                    }

                    <div class="all-shirts-wrapper">
                    <div class="shirt-container" style="background-image:url('http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-classic-short-sleeve-tee.png')"></div>
                    <div class="shirt-container" style="background-image:url('http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-pullover-hoodie.png')"></div>
                    <div class="shirt-container" style="background-image:url('http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_womens-premium-semi-fitted-v-neck.png')"></div>

                    </div>








                    share|improve this answer












                    Use image as background like this.






                    div {
                    background-color: indigo;
                    }

                    .shirt-container img {
                    height: 225px;
                    position: relative;
                    z-index: 3;
                    }

                    .all-shirts-wrapper {
                    display: flex;
                    /* width: 41px; */
                    }

                    .shirt-container {
                    width: 150px;
                    height: 200px;
                    position: relative;
                    background-size: 200px auto;
                    background-repeat: no-repeat;
                    background-position: center;
                    }

                    <div class="all-shirts-wrapper">
                    <div class="shirt-container" style="background-image:url('http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-classic-short-sleeve-tee.png')"></div>
                    <div class="shirt-container" style="background-image:url('http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-pullover-hoodie.png')"></div>
                    <div class="shirt-container" style="background-image:url('http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_womens-premium-semi-fitted-v-neck.png')"></div>

                    </div>








                    div {
                    background-color: indigo;
                    }

                    .shirt-container img {
                    height: 225px;
                    position: relative;
                    z-index: 3;
                    }

                    .all-shirts-wrapper {
                    display: flex;
                    /* width: 41px; */
                    }

                    .shirt-container {
                    width: 150px;
                    height: 200px;
                    position: relative;
                    background-size: 200px auto;
                    background-repeat: no-repeat;
                    background-position: center;
                    }

                    <div class="all-shirts-wrapper">
                    <div class="shirt-container" style="background-image:url('http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-classic-short-sleeve-tee.png')"></div>
                    <div class="shirt-container" style="background-image:url('http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-pullover-hoodie.png')"></div>
                    <div class="shirt-container" style="background-image:url('http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_womens-premium-semi-fitted-v-neck.png')"></div>

                    </div>





                    div {
                    background-color: indigo;
                    }

                    .shirt-container img {
                    height: 225px;
                    position: relative;
                    z-index: 3;
                    }

                    .all-shirts-wrapper {
                    display: flex;
                    /* width: 41px; */
                    }

                    .shirt-container {
                    width: 150px;
                    height: 200px;
                    position: relative;
                    background-size: 200px auto;
                    background-repeat: no-repeat;
                    background-position: center;
                    }

                    <div class="all-shirts-wrapper">
                    <div class="shirt-container" style="background-image:url('http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-classic-short-sleeve-tee.png')"></div>
                    <div class="shirt-container" style="background-image:url('http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-pullover-hoodie.png')"></div>
                    <div class="shirt-container" style="background-image:url('http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_womens-premium-semi-fitted-v-neck.png')"></div>

                    </div>






                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Nov 9 at 4:21









                    kiranvj

                    12.1k23350




                    12.1k23350
























                        up vote
                        1
                        down vote













                        You can use object-fit: cover to crop the images from left and right at the width you want (there the images are 225px wide, so let's make them at a width of 170px to remove most of the blanks left and right)



                        See Fiddle






                        share|improve this answer





















                        • Yes, this is another option, make sure to check browser support before using caniuse.com/#search=object-fit
                          – kiranvj
                          Nov 9 at 4:32















                        up vote
                        1
                        down vote













                        You can use object-fit: cover to crop the images from left and right at the width you want (there the images are 225px wide, so let's make them at a width of 170px to remove most of the blanks left and right)



                        See Fiddle






                        share|improve this answer





















                        • Yes, this is another option, make sure to check browser support before using caniuse.com/#search=object-fit
                          – kiranvj
                          Nov 9 at 4:32













                        up vote
                        1
                        down vote










                        up vote
                        1
                        down vote









                        You can use object-fit: cover to crop the images from left and right at the width you want (there the images are 225px wide, so let's make them at a width of 170px to remove most of the blanks left and right)



                        See Fiddle






                        share|improve this answer












                        You can use object-fit: cover to crop the images from left and right at the width you want (there the images are 225px wide, so let's make them at a width of 170px to remove most of the blanks left and right)



                        See Fiddle







                        share|improve this answer












                        share|improve this answer



                        share|improve this answer










                        answered Nov 9 at 4:25









                        Plotisateur

                        363314




                        363314












                        • Yes, this is another option, make sure to check browser support before using caniuse.com/#search=object-fit
                          – kiranvj
                          Nov 9 at 4:32


















                        • Yes, this is another option, make sure to check browser support before using caniuse.com/#search=object-fit
                          – kiranvj
                          Nov 9 at 4:32
















                        Yes, this is another option, make sure to check browser support before using caniuse.com/#search=object-fit
                        – kiranvj
                        Nov 9 at 4:32




                        Yes, this is another option, make sure to check browser support before using caniuse.com/#search=object-fit
                        – kiranvj
                        Nov 9 at 4:32










                        up vote
                        1
                        down vote













                        Here's my solution:






                        div {
                        background-color: indigo;
                        }

                        .shirt-container img {
                        height: 225px;
                        position: absolute;
                        z-index: 3;
                        left: 50%;
                        transform: translateX(-50%);
                        }

                        .all-shirts-wrapper {
                        display: flex;
                        /* width: 41px; */
                        }

                        .shirt-container {
                        width: 160px;
                        height: 225px;
                        position: relative;
                        overflow: hidden;
                        }

                        <div class="all-shirts-wrapper">
                        <div class="shirt-container"><img src="http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-classic-short-sleeve-tee.png"></div>
                        <div class="shirt-container"><img src="http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-pullover-hoodie.png"></div>
                        <div class="shirt-container"><img src="http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_womens-premium-semi-fitted-v-neck.png"></div>
                        </div>








                        share|improve this answer

























                          up vote
                          1
                          down vote













                          Here's my solution:






                          div {
                          background-color: indigo;
                          }

                          .shirt-container img {
                          height: 225px;
                          position: absolute;
                          z-index: 3;
                          left: 50%;
                          transform: translateX(-50%);
                          }

                          .all-shirts-wrapper {
                          display: flex;
                          /* width: 41px; */
                          }

                          .shirt-container {
                          width: 160px;
                          height: 225px;
                          position: relative;
                          overflow: hidden;
                          }

                          <div class="all-shirts-wrapper">
                          <div class="shirt-container"><img src="http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-classic-short-sleeve-tee.png"></div>
                          <div class="shirt-container"><img src="http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-pullover-hoodie.png"></div>
                          <div class="shirt-container"><img src="http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_womens-premium-semi-fitted-v-neck.png"></div>
                          </div>








                          share|improve this answer























                            up vote
                            1
                            down vote










                            up vote
                            1
                            down vote









                            Here's my solution:






                            div {
                            background-color: indigo;
                            }

                            .shirt-container img {
                            height: 225px;
                            position: absolute;
                            z-index: 3;
                            left: 50%;
                            transform: translateX(-50%);
                            }

                            .all-shirts-wrapper {
                            display: flex;
                            /* width: 41px; */
                            }

                            .shirt-container {
                            width: 160px;
                            height: 225px;
                            position: relative;
                            overflow: hidden;
                            }

                            <div class="all-shirts-wrapper">
                            <div class="shirt-container"><img src="http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-classic-short-sleeve-tee.png"></div>
                            <div class="shirt-container"><img src="http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-pullover-hoodie.png"></div>
                            <div class="shirt-container"><img src="http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_womens-premium-semi-fitted-v-neck.png"></div>
                            </div>








                            share|improve this answer












                            Here's my solution:






                            div {
                            background-color: indigo;
                            }

                            .shirt-container img {
                            height: 225px;
                            position: absolute;
                            z-index: 3;
                            left: 50%;
                            transform: translateX(-50%);
                            }

                            .all-shirts-wrapper {
                            display: flex;
                            /* width: 41px; */
                            }

                            .shirt-container {
                            width: 160px;
                            height: 225px;
                            position: relative;
                            overflow: hidden;
                            }

                            <div class="all-shirts-wrapper">
                            <div class="shirt-container"><img src="http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-classic-short-sleeve-tee.png"></div>
                            <div class="shirt-container"><img src="http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-pullover-hoodie.png"></div>
                            <div class="shirt-container"><img src="http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_womens-premium-semi-fitted-v-neck.png"></div>
                            </div>








                            div {
                            background-color: indigo;
                            }

                            .shirt-container img {
                            height: 225px;
                            position: absolute;
                            z-index: 3;
                            left: 50%;
                            transform: translateX(-50%);
                            }

                            .all-shirts-wrapper {
                            display: flex;
                            /* width: 41px; */
                            }

                            .shirt-container {
                            width: 160px;
                            height: 225px;
                            position: relative;
                            overflow: hidden;
                            }

                            <div class="all-shirts-wrapper">
                            <div class="shirt-container"><img src="http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-classic-short-sleeve-tee.png"></div>
                            <div class="shirt-container"><img src="http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-pullover-hoodie.png"></div>
                            <div class="shirt-container"><img src="http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_womens-premium-semi-fitted-v-neck.png"></div>
                            </div>





                            div {
                            background-color: indigo;
                            }

                            .shirt-container img {
                            height: 225px;
                            position: absolute;
                            z-index: 3;
                            left: 50%;
                            transform: translateX(-50%);
                            }

                            .all-shirts-wrapper {
                            display: flex;
                            /* width: 41px; */
                            }

                            .shirt-container {
                            width: 160px;
                            height: 225px;
                            position: relative;
                            overflow: hidden;
                            }

                            <div class="all-shirts-wrapper">
                            <div class="shirt-container"><img src="http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-classic-short-sleeve-tee.png"></div>
                            <div class="shirt-container"><img src="http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-pullover-hoodie.png"></div>
                            <div class="shirt-container"><img src="http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_womens-premium-semi-fitted-v-neck.png"></div>
                            </div>






                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Nov 9 at 4:35









                            Yan

                            215




                            215






















                                up vote
                                0
                                down vote













                                You could try adding the images as a background to each div. That may allow you to eliminate the white space to the right and left of each image.



                                <div class="all-shirts-wrapper">
                                <div class="shirt-container" style="background-image: url(http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-classic-short-sleeve-tee.png)"></div>
                                <div class="shirt-container" style="background-image: url(http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-pullover-hoodie.png)"></div>
                                <div class="shirt-container" style="background-image: url(http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_womens-premium-semi-fitted-v-neck.png)"></div>
                                </div>

                                div {
                                background-color: indigo;
                                }
                                .shirt-container {background-size:contain; background-repeat: no-repeat;}

                                .shirt-container img {
                                height: 225px;
                                position: relative;
                                z-index: 3;
                                }

                                .all-shirts-wrapper {
                                display: flex;
                                /* width: 41px; */
                                height: 200px;
                                }

                                .shirt-container {
                                width: 140px;
                                position: relative;
                                }


                                https://jsfiddle.net/uxwnkets/






                                share|improve this answer

























                                  up vote
                                  0
                                  down vote













                                  You could try adding the images as a background to each div. That may allow you to eliminate the white space to the right and left of each image.



                                  <div class="all-shirts-wrapper">
                                  <div class="shirt-container" style="background-image: url(http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-classic-short-sleeve-tee.png)"></div>
                                  <div class="shirt-container" style="background-image: url(http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-pullover-hoodie.png)"></div>
                                  <div class="shirt-container" style="background-image: url(http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_womens-premium-semi-fitted-v-neck.png)"></div>
                                  </div>

                                  div {
                                  background-color: indigo;
                                  }
                                  .shirt-container {background-size:contain; background-repeat: no-repeat;}

                                  .shirt-container img {
                                  height: 225px;
                                  position: relative;
                                  z-index: 3;
                                  }

                                  .all-shirts-wrapper {
                                  display: flex;
                                  /* width: 41px; */
                                  height: 200px;
                                  }

                                  .shirt-container {
                                  width: 140px;
                                  position: relative;
                                  }


                                  https://jsfiddle.net/uxwnkets/






                                  share|improve this answer























                                    up vote
                                    0
                                    down vote










                                    up vote
                                    0
                                    down vote









                                    You could try adding the images as a background to each div. That may allow you to eliminate the white space to the right and left of each image.



                                    <div class="all-shirts-wrapper">
                                    <div class="shirt-container" style="background-image: url(http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-classic-short-sleeve-tee.png)"></div>
                                    <div class="shirt-container" style="background-image: url(http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-pullover-hoodie.png)"></div>
                                    <div class="shirt-container" style="background-image: url(http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_womens-premium-semi-fitted-v-neck.png)"></div>
                                    </div>

                                    div {
                                    background-color: indigo;
                                    }
                                    .shirt-container {background-size:contain; background-repeat: no-repeat;}

                                    .shirt-container img {
                                    height: 225px;
                                    position: relative;
                                    z-index: 3;
                                    }

                                    .all-shirts-wrapper {
                                    display: flex;
                                    /* width: 41px; */
                                    height: 200px;
                                    }

                                    .shirt-container {
                                    width: 140px;
                                    position: relative;
                                    }


                                    https://jsfiddle.net/uxwnkets/






                                    share|improve this answer












                                    You could try adding the images as a background to each div. That may allow you to eliminate the white space to the right and left of each image.



                                    <div class="all-shirts-wrapper">
                                    <div class="shirt-container" style="background-image: url(http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-classic-short-sleeve-tee.png)"></div>
                                    <div class="shirt-container" style="background-image: url(http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_adult-pullover-hoodie.png)"></div>
                                    <div class="shirt-container" style="background-image: url(http://awsdevelopment.tzilla.com/artwork/merged/efda3758-f8b5-4d71-8a91-5240dd64aef6-out_womens-premium-semi-fitted-v-neck.png)"></div>
                                    </div>

                                    div {
                                    background-color: indigo;
                                    }
                                    .shirt-container {background-size:contain; background-repeat: no-repeat;}

                                    .shirt-container img {
                                    height: 225px;
                                    position: relative;
                                    z-index: 3;
                                    }

                                    .all-shirts-wrapper {
                                    display: flex;
                                    /* width: 41px; */
                                    height: 200px;
                                    }

                                    .shirt-container {
                                    width: 140px;
                                    position: relative;
                                    }


                                    https://jsfiddle.net/uxwnkets/







                                    share|improve this answer












                                    share|improve this answer



                                    share|improve this answer










                                    answered Nov 9 at 4:31









                                    Georgia Ferguson

                                    12




                                    12






























                                        draft saved

                                        draft discarded




















































                                        Thanks for contributing an answer to Stack Overflow!


                                        • Please be sure to answer the question. Provide details and share your research!

                                        But avoid



                                        • Asking for help, clarification, or responding to other answers.

                                        • Making statements based on opinion; back them up with references or personal experience.


                                        To learn more, see our tips on writing great answers.





                                        Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                                        Please pay close attention to the following guidance:


                                        • Please be sure to answer the question. Provide details and share your research!

                                        But avoid



                                        • Asking for help, clarification, or responding to other answers.

                                        • Making statements based on opinion; back them up with references or personal experience.


                                        To learn more, see our tips on writing great answers.




                                        draft saved


                                        draft discarded














                                        StackExchange.ready(
                                        function () {
                                        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53219692%2fmake-images-be-closer-to-each-other%23new-answer', 'question_page');
                                        }
                                        );

                                        Post as a guest















                                        Required, but never shown





















































                                        Required, but never shown














                                        Required, but never shown












                                        Required, but never shown







                                        Required, but never shown

































                                        Required, but never shown














                                        Required, but never shown












                                        Required, but never shown







                                        Required, but never shown







                                        這個網誌中的熱門文章

                                        Xamarin.form Move up view when keyboard appear

                                        Post-Redirect-Get with Spring WebFlux and Thymeleaf

                                        Anylogic : not able to use stopDelay()