简体   繁体   English

删除图像之间的空间

[英]Removing space between images

image I have a block of images but they are not connected to one another, I need to remove the spaces and make them looked attached. 我有图像块,但他们没有相互连接,我需要把空格去掉,使它们看起来连接。 I have tried the following but doesn't work 我已经尝试了以下方法,但是不起作用

img {
 border: 0 none;
box-shadow: none;
padding:0px;
float: left;
display:block;
float:left;
line-height:0;
}

This is my html 这是我的HTML

  <div class="col-xs-4 col-md-3 ">
            <div class="hovereffect">
             <img src="images/plasma.jpg" alt="Plasma" id="space">
            <div class="overlay">
           <h3>
           <a href="#" class="link">Creativity on Combined Photos</a>
           </h3>
            <p> 
                <a href="#" class="link">LINK HERE</a>
            </p> 
        </div>
      </div> 
      </div>

Please see the image where the problem is. 请查看问题所在的图片。

 .test{ display:flex } 
 <div class="test"> <div class="hovereffect"> <img src="http://placehold.it/350x150"> <div class="overlay"> <h3> <a href="#" class="link">Creativity on Combined Photos</a> </h3> <p> <a href="#" class="link">LINK HERE</a> </p> </div> </div> <div class="hovereffect"> <img src="http://placehold.it/350x150"> <div class="overlay"> <h3> <a href="#" class="link">Creativity on Combined Photos</a> </h3> <p> <a href="#" class="link">LINK HERE</a> </p> </div> </div> </div> 

is it something like this you are looking for? 您正在寻找这样的东西吗?

I did this with flexbox you just give the parent of the images display:flex; 我用flexbox做到了这一点,您只是给图像的父级显示:flex;

if you not want them one next to each other you can do it this way 如果您不希望他们彼此挨着,可以这样做

 .test{ display:flex; flex-direction:column } .hovereffect{ display:flex; } 
 <div class="test"> <div class="hovereffect"> <img src="http://placehold.it/350x150"> <div class="overlay"> <h3> <a href="#" class="link">Creativity on Combined Photos</a> </h3> <p> <a href="#" class="link">LINK HERE</a> </p> </div> </div> <div class="hovereffect"> <img src="http://placehold.it/350x150"> <div class="overlay"> <h3> <a href="#" class="link">Creativity on Combined Photos</a> </h3> <p> <a href="#" class="link">LINK HERE</a> </p> </div> </div> </div> 

Please try this: 请尝试以下方法:

img {
border: 0 none;
box-shadow: none;
padding:0px;
float: left;
display:block;
margin:0;
line-height:0;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM