两个图像之间的空间使用CSS

时间:2016-02-22 17:11:54

标签: html css

css困扰我的定位。我有很多图片要实现,我把所有类都集中在一起工作正常。但我需要在图片之间留出个人空间。百分比或像素并不重要。

这是Html文件中的代码:

<div class="picture">
  <!—PIC1 -->
  <a href="http://.....” target="_blank">
    <img src="pic2"  width="149" height="114">
  </a>
  <!—PIC2 -->
  <a href="http://.....” target="_blank">
    <img src="pic1"  width="149" height="114">
  </a>
  </a>
</div>

CSS的一部分看起来像这样:

.pictures {
    width: 100%;
    text-align:center;
    /* please help*/
}

2 个答案:

答案 0 :(得分:1)

在JSFiddle上查看此demo

a{
   text-decoration:none;
}
img{
   margin:1em;
   /* Space will be occupied all four sides Top, Right, Bottom & Left */
}

答案 1 :(得分:0)

如果您没有指定任何内容,可以尝试:

img{
  margin-right:10px; //your space here
}