html - 如何将一张图片放在另一张图片下面并居中?

标签 html css

我想知道是否有人知道如何在所有 4 张图片的相册封面下放置下载按钮图片,如下代码和图片所示:

<center>
    <img src="images/london-front-cover.jpg" alt="Londen front cover" width="200" height="200">
    <img src="images/london-volume.jpg" alt="Londen Volume (front cover)" width="200" height="200" border:none;>
    <img src="images/love-hate-volume.jpg" alt="Love Hate Volume (front cover)" width="200" height="200">
    <img src="images/gurbet-eli-volume.JPG" alt="Gurbet Eli Volume (front cover)" width="200" height="200">
    </br>
</center>
<a href="Londen-vol1.zip">
    <img src="images/downloadbutton.png" alt="downloadbutton" width="150" height="50">
</a>
</br>
</br>

Picture

最佳答案

这应该有效。您可以用图像替换 anchor 或在 a 标签内添加图像。

.clearfix {
  clear: both;
}
.divWithBtn {
  float: left;
  text-align: center;
}
.divWithBtn img,
.divWithBtn a{
  display: block;
  margin: 0 auto;
}
<div class="clearfix">
<div class="divWithBtn">
<img src="http://placehold.it/100x100" alt="">
<a href="">download</a>
</div>
<div class="divWithBtn">
<img src="http://placehold.it/100x100" alt="">
<a href="">download</a>
</div>
<div class="divWithBtn">
<img src="http://placehold.it/100x100" alt="">
<a href="">download</a>
</div>
<div class="divWithBtn">
<img src="http://placehold.it/100x100" alt="">
<a href="">download</a>
</div>
</div>

关于html - 如何将一张图片放在另一张图片下面并居中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34459408/

相关文章:

html - 为什么我不能使用 CSS 来移动按钮?

css - 设置最小宽度以适应响应式网站

jquery - 给定一组 div,如何确定连续的最后一个

HTML 元素在 Mac 上正确定位但在 PC 上不正确

javascript - 盒式磁带的替代品?

html - 如何在wordpress中显示博客文章?

html - ie7 中指定宽度的按钮自动换行?

css - 为什么我的线性渐变在 Firefox 中不起作用?

html - 在 Powershell 中将多个输出发送到同一个 HTML 文件

html - 使用 colspan 时如何修复填充 Twitter Bootstrap 单元格表