【问题标题】:Text over image positioning with css使用 css 定位图像上的文本
【发布时间】:2013-08-17 16:28:12
【问题描述】:

如何在“这里”的图像上放置文字?
它必须从环绕开始 20px,固定为 250px。

HTML

<div class="background-image">
    <img src="img/picture.jpg" alt="pasta-town">
    <div id="motto" class="wrap">
        <div>some motto</div>
    </div>
</div>

CSS

#motto {
font-size: 26px;
font-family: "MetaProMedium";
position: absolute; 
top:0;
}
#motto div {
left: 755px;
width: 250px;
}
.background-image {
position: relative;
width: 100%;
}
.background-image > img {
width: 100%;
}

【问题讨论】:

  • 如果您使用的是图像,请尝试使用 html 图像映射选项!
  • here 框的父对象是什么? td ? div?或者..什么?

标签: html css image text


【解决方案1】:

您需要调整包含图像的 div 和要定位的文本的 z-index 较高的 z-index 将覆盖较低的 z-index。

【讨论】:

    猜你喜欢
    • 2017-07-15
    • 1970-01-01
    • 2012-02-01
    • 2019-03-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多