html - 页脚图像上的文字

标签 html css image text

我想在页脚图片上添加版权文本,所以我制作了一个 ID 为“copyright”的段落。这是在我的 css 文件中:

.footer {
background: url(../images/footer_extend.png) repeat-x center;
overflow: hidden;
 }
.footer img {
    display:block;
    margin:0px auto;
    max-width:970px;
    height: 130px;
    overflow: hidden;
}
#copyright{
position:absolute;
color:#000;
bottom:1px;
left:46%;
}

所以文本应该居中,白色并且在页面的最底部。但对我来说,文本位于页面的中间(而不是底部)。为什么以及如何解决这个问题?

哦,这是我的 html 文件:

<div class="footer">
    <img src="images/footer.png" width="970" height="130" alt="" />
    <p id="copyright">© 2013</p>
</div>

最佳答案

您可能想将 position: relative 添加到 .footer

关于html - 页脚图像上的文字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19304890/

相关文章:

html - 如何在 bootstrap 中将 2 个图像居中

css transform 属性上的 CSS Transition 导致父项仅在 Google Chrome 中闪烁

javascript - 在缩略图下面贴一个 div + 限制宽度

javascript - 使用 Angular,如何将 `input` `ng-repeat` 中的 `div` 文本绑定(bind)到另一个 `div` 中的另一个 `ng-repeat` ?

html - 根据屏幕尺寸对不同容器中的元素重新排序

html - 不使用 CSS3 的边缘更具吸引力和美观

javascript - 使用 jQuery 创建新属性

javascript - 将图像居中放置在页面中间

java - 在 Android Java 中动态更改图像的前景颜色(保留 alpha 透明度)

java - 如何在eclipse中访问图像文件(servlet/html)