包含图像的锚点占用整页宽度

时间:2013-07-24 19:27:09

标签: html css

my website上,底部有“在App Store上下载”按钮,可以在按钮高度内从页面的整个宽度点击按钮的链接。我没有在HTML或CSS中看到导致这种情况的任何内容:

    <div class="download">
        <a href="#"><img src="images/download-on-appstore.png" alt="Download on App Store"></a>
    </div>

造成这种情况的原因是什么?

2 个答案:

答案 0 :(得分:3)

在你的CSS中,你有这个:

.app-details .download img {
    display: block;
    margin: auto;
}

img设置为显示块,占用所有可用空间。

答案 1 :(得分:1)

之前的答案是正确的......但要解决它:

从img中移除display:block并将.apps-details .download css设为:

.app-details .download {
     background: url("../images/letters-bg.png") no-repeat;
     background-position: 57% 10%;
     padding: 150px 0;
     margin: 0 auto;
     text-align: center;
}