简体   繁体   English

在图像之间添加空间

[英]adding space between images

How can I add some space to the following images Meaning that I want horizontal space in between the following images如何为以下图像添加一些空间意味着我希望在以下图像之间有水平空间

<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>

and the css code和 css 代码

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

you were targeting the container of your images, not the images themselves.您的目标是图像的容器,而不是图像本身。 to fix this, simply add any of the following CSS lines to your file要解决此问题,只需将以下任何 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*/
}

just one of them should do the job, let me know if this is what you need.只有其中一个应该完成这项工作,如果这是您需要的,请告诉我。

check this Live demo for more details: http://jsfiddle.net/3jApT/3/查看此现场演示以了解更多详细信息: http : //jsfiddle.net/3jApT/3/

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

add hspace="20" for a foto's为照片添加 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>
p.menusomething img 
{
    margin-bottom:10px;
}
.menusomething img {
 display:block;
 margin:10px 0 10px 0;
}

display: flex;显示:弹性;

justify-content: space-between;对齐内容:间隔;

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

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