简体   繁体   English

将div放在图像顶部

[英]Place div on top of image

I have tried all the solutions I have found on the new trying to get this div to sit on top of the image. 我已经尝试了我在新尝试的所有解决方案,试图让这个div坐在图像的顶部。

We have a background image, and as you can see from the image below are four words Eversoft, TruSoft, Solarmax and Active Family. 我们有一个背景图片,从下图中可以看到Eversoft,TruSoft,Solarmax和Active Family四个单词。

在此输入图像描述

These four words need to be moved up into the boxes on the picture, but I can get the CSS right, this is how my page is constructed 这四个单词需要移动到图片上的方框中,但是我可以正确地使用CSS,这就是我的页面构造方式

<div class="row">
   <img src="~/Content/Images/Mobile-BackGround-new-2.png" class="img-responsive" style="position: relative" />
   <div id="stainMasterLinksContainer">
    <div id="stainMasterLinksTop">
        <a href='@Url.Action("Eversoft", "Eversoft")' style="color: #934991;" class="GothamFont" id="Eversoft"><b>EverSoft</b> <small><sup>®</sup></small></a>
        <a href='@Url.Action("Trusoft", "Trusoft")' style="color: #f7acb7" class="GothamFont"><b>TruSoft</b> <small><sup>®</sup></small></a>
    </div>
    <div id="stainMasterLinksBottom">
        <a href='@Url.Action("Solarmax", "Solarmax")' style="color: #ffe600" class="GothamFont" id="Solarmax"><b>SolarMax</b> <small><sup>®</sup></small></a>
        <a href='@Url.Action("ActiveFamily", "ActiveFamily")' style="color: #dc1e33" class="GothamFont" id="ActiveFamily"><b>Active Family</b> <small><sup>™</sup></small></a>
    </div>
</div>

And I'm currently using this CSS for the stainMasterLinksContainer 我目前正在使用这个CSS作为stainMasterLinksContainer

#stainMasterLinksContainer {
padding-top: -40%;
font-size: 15.5px;
position: relative;
z-index: 100;

}

Any help would be appreciated. 任何帮助,将不胜感激。

It CAN be done. 可以办到。 Here's one way: 这是一种方式:

 <img src="http://practicalaction.org/images/sea-of-ducks-300.jpg" style="position:absolute; left:0px; top:0px"/> <div style="background-color:blue;position:relative;left:80px; top:80px; width:50px;"> Hello</div> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM