Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/39.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在img html css上放置图像和文本_Html_Css - Fatal编程技术网

如何在img html css上放置图像和文本

如何在img html css上放置图像和文本,html,css,Html,Css,我有图像,我应该使图片和地方的文字按钮上也一样,在这张图片上的文字,我想把黄色按钮的文字也取代所有的文字 所有文本都应该像 HTML: <div style="width: 450px; display: inline-block; vertical-align: top"> <table align="left" cellspacing="0" cellpadding="0"> <tr> <td>

我有图像,我应该使图片和地方的文字按钮上也一样,在这张图片上的文字,我想把黄色按钮的文字也取代所有的文字

所有文本都应该像

HTML:

<div style="width: 450px; display: inline-block; vertical-align: top">
    <table align="left" cellspacing="0" cellpadding="0">
        <tr>
            <td>
                <!-- ^Текст --> <span style="display: block; overflow: hidden; width: 390px; height: 400px; margin-left:10px">
                                        <div class="image-wrapper"><img src="http://i.imgur.com/dbaQzUC.png" alt="" style="width: 250px" class="fluid-img">  <a href="http://icome.su">Подробнее</a></div>



                                </span>

                <!-- $Текст -->
            </td>
        </tr>
    </table>
</div>
这是我的


像这样的东西怎么样:

它通过使用position:absolute和z-index将文本放置在图像上来完成

以下是HTML:

<div id="container">
    <img id="image" src="image.jpg"/>
    <p id="text">
    <a href="#" i="button">Visit</button>
    </p>
</div>

像这样的怎么样:

它通过使用position:absolute和z-index将文本放置在图像上来完成

以下是HTML:

<div id="container">
    <img id="image" src="image.jpg"/>
    <p id="text">
    <a href="#" i="button">Visit</button>
    </p>
</div>
像这样的

HTML:

像这样的事

HTML:


我试图复制你的图像(没有精确的尺寸)。请查看:

.img容器{
位置:相对位置;
宽度:250px;
高度:350px;
-moz边界半径:20px;
-webkit边界半径:20px;
边界半径:20px;
溢出:隐藏;
}
.img集装箱。折扣,
.img container.desc,
.img集装箱img,
.img容器p,
.img集装箱跨度,
.img容器a{
位置:绝对位置;
显示:块;
}
.img集装箱。折扣{
顶部:10px;
左:10px;
宽度:50px;
高度:50px;
背景色:红色;
-moz边界半径:50px;
-webkit边界半径:50px;
边界半径:50px;
颜色:#fff;
字体样式:20px;
字体大小:粗体;
z指数:1;
}
.img集装箱。折扣跨度{
最高:50%;
左:50%;
-moz变换:平移(-50%,-50%);
-ms转换:翻译(-50%,-50%);
-webkit转换:翻译(-50%,-50%);
转换:翻译(-50%,-50%);
}
.img容器。描述{
底部:0;
左:0;
宽度:100%;
高度:110px;
背景色:rgba(255、255、255、0.4);
文本对齐:居中;
}
.img容器。描述a{
文字装饰:无;
颜色:白色;
字体大小:粗体;
填充:3px6px;
文本转换:大写;
背景颜色:橙色;
边界:无;
底部:10px;
右:15px;
}

50%
Lorem ipsum dolor sit amet,奉献精英。自然质量减去身体质量

>
我试图复制你的图像(没有精确的尺寸)。请查看:

.img容器{
位置:相对位置;
宽度:250px;
高度:350px;
-moz边界半径:20px;
-webkit边界半径:20px;
边界半径:20px;
溢出:隐藏;
}
.img集装箱。折扣,
.img container.desc,
.img集装箱img,
.img容器p,
.img集装箱跨度,
.img容器a{
位置:绝对位置;
显示:块;
}
.img集装箱。折扣{
顶部:10px;
左:10px;
宽度:50px;
高度:50px;
背景色:红色;
-moz边界半径:50px;
-webkit边界半径:50px;
边界半径:50px;
颜色:#fff;
字体样式:20px;
字体大小:粗体;
z指数:1;
}
.img集装箱。折扣跨度{
最高:50%;
左:50%;
-moz变换:平移(-50%,-50%);
-ms转换:翻译(-50%,-50%);
-webkit转换:翻译(-50%,-50%);
转换:翻译(-50%,-50%);
}
.img容器。描述{
底部:0;
左:0;
宽度:100%;
高度:110px;
背景色:rgba(255、255、255、0.4);
文本对齐:居中;
}
.img容器。描述a{
文字装饰:无;
颜色:白色;
字体大小:粗体;
填充:3px6px;
文本转换:大写;
背景颜色:橙色;
边界:无;
底部:10px;
右:15px;
}

50%
Lorem ipsum dolor sit amet,奉献精英。自然质量减去身体质量

>
谢谢,但我试过你的代码,它在浏览器中工作,但我不能在电子邮件html中工作???谢谢,但我试过你的代码,它在浏览器中工作,但我不能在电子邮件html中工作???谢谢,但为什么你的代码也不能在电子邮件html中工作?邮件非常详细,它不像通常的网页,我们必须使用表而不是标准的div。您需要通过电子邮件发送此信息吗?谢谢,但为什么您的代码在电子邮件中也不起作用HTMLemail非常详细,它不像通常的网页,我们必须使用表而不是标准div。你需要通过电子邮件发送吗?@Sultan:你在问题中的代码对你来说很好用me@Sultan:问题中的代码对我来说很好
#container
{
    height:400px;
    width:400px;
    position:relative;
}

#image
{    
    position:absolute;
    left:0;
    top:0;
}
#text
{
    z-index:100;
    position:absolute;    
    color:white;
    font-size:24px;
    font-weight:bold;
    left:150px;
    top:350px;
}

#button
{
    height:40px;
    width:100px;
    background-color:orange;
}
<div class="item">
    <img src="image.jpg" alt="Alternative text" />
    <p class="discount">50%</p>
    <p class="desc">This is a description text</p>
</div>
* { margin: 0; padding: 0; }
.item {
    width: 400px;
    height: 400px;
    position: relative;
    border-radius: 25px;
    overflow: hidden;
}
.item img {
    max-width: 100%;
    max-height: 100%;
}
.discount {
    background: #EE6666;
    width: 75px;
    height: 75px;
    display: block;
    position: absolute;
    top: 10px;
    left: 10px;
    border-radius: 50%;
    font-size: 2em;
    line-height: 75px;
    vertical-align: middle;
    text-align: center;
    color: white;
    -webkit-box-shadow: 5px 5px 5px 0px rgba(50, 50, 50, 0.75);
    -moz-box-shadow:    5px 5px 5px 0px rgba(50, 50, 50, 0.75);
    box-shadow:         5px 5px 5px 0px rgba(50, 50, 50, 0.75);
}
.desc {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 1em;
    background: rgb(255,255,255);
    background: rgba(255,255,255,.6);
}