在图像之间添加空间

时间:2012-02-14 14:51:31

标签: html css

如何为以下图像添加一些空间 这意味着我想要在以下图像之间的水平空间

<p class="menusomething">In-game Imagery</br>
<a href="R.jpg"><img src="age1.jpg" width="200" height="150"/>          </a></br>
<a href="Re2.jpg"><img src="age2.jpg" width="200" height="150"/>   </a></BR>
<a href="Ri.jpg"><img src="Re3.jpg" width="200" height="150"/></a></BR>
<a href="Ri4.jpg"><img src="e4.jpg" width="200" height="150"/></a></BR>
</p>

和css代码

p.menusomething{background: white;
   margin: auto;
   margin-top: 200px;
   margin-left: 10px;
   padding: 10px;
   width: 200px;}

6 个答案:

答案 0 :(得分:4)

您定位的是图片的容器,而不是图片本身。 要解决此问题,只需将以下任何CSS行添加到您的文件

p.menusomething a>img
{
   margin-top:20px; /*to have the space above the image*/
   margin-bottom:20px; /*to have the space under the image*/
}

其中只有一个人应该做这个工作,让我知道这是否是你需要的。

查看此实时演示了解更多详情:http://jsfiddle.net/3jApT/3/

答案 1 :(得分:1)

p.menusomething a img {
margin: 0 10px 0 0;
}

答案 2 :(得分:0)

p.menusomething img 
{
    margin-bottom:10px;
}

答案 3 :(得分:0)

.menusomething img {
 display:block;
 margin:10px 0 10px 0;
}

答案 4 :(得分:0)

为foto的

添加hspace =“20”
<p class="menusomething">In-game Imagery</br>
<a href="R.jpg"><img src="age1.jpg" width="200" height="150" hspace="20" />          </a></br>
<a href="Re2.jpg"><img src="age2.jpg" width="200" height="150" hspace="20" />   </a></BR>
<a href="Ri.jpg"><img src="Re3.jpg" width="200" height="150" hspace="20" /></a></BR>
<a href="Ri4.jpg"><img src="e4.jpg" width="200" height="150" hspace="20" /></a></BR>
</p>

答案 5 :(得分:-1)

显示:弹性;

justify-content: space-between;

相关问题