显示图像水平CSS图像、水平、CSS

2023-09-11 08:01:07 作者:ˊ爱情破绽

Imhaving在我的网站有点难度与CSS样式,现在我有一个排,我想水平对齐沿着我的页面图像。但就现在它在一排显示他们所有垂直和我不知道为什么。所有的图像都存储在一个阵列,它只是得到他们一字排开,这就是问题所在。 这里是我的code:

  .IMG {
浮动:左;
宽度:120px;
保证金:汽车;
保证金左:10px的;
填充:5px的;
}
 

解决方案

您应该添加到您的样式显示:inline-block的。该 inline-block的值使,你.IMG是不是一个新的行结束时显示。

css背景图片 水平居左,垂直居中有什么作用

Imhaving a bit of difficulty with CSS styling on my website, Currently I have a row of images that I'd like to align horizontally along my page. But just now it displays them all vertically in a row and I'm not sure why. All the images are stored in an array, it's just getting them lined up that's the problem. here is my code:

   .img{
float:left;
width:120px;
margin:auto;
margin-left:10px;
padding:5px;
}

解决方案

You should add the to your style display:inline-block. The inline-block value makes, that your .img is not displayed with a new-line at the end.