【发布时间】:2014-06-24 06:49:05
【问题描述】:
我需要一些帮助。
我目前正在开发一个响应式网站。
将发布指向该网站 psd 图像的链接,以便您了解
它应该是什么样的。
Link to the site itself
该站点的宽度为 1200 像素,当您缩放站点时,您会看到船什么也不做
现在解决问题。
问题出在这艘船上,这个 img 是 1019x1732 并且是绝对定位的。并且需要这样做,因为我必须使用 z-index 才能将其定位在其他一些 div 之上,因为它相当大。
我试图把它作为背景图像和一个带有相对 div 的 img 标签。但什么也没发生。
如果我的问题难以理解,我表示感谢。很难向其他人解释问题,它总是在我的脑海中更有意义。
这是我的代码:
我的html
<div id="wrapperHero">
<div id="hero">
<p>The "Banarly Group" has been operating<br>
in Nigerian, Gabonese and Cameroon waters<br>
since 1995.
</p>
<div id="circle">
<p>a fleet of<br>
<span class="number">24</span><span class="trawler">trawlers</p>
</div>
</div>
<div id="boat">
<img src="img/BAN_herofg.png" alt="boat">
</div>
</div>
我的 CSS:
#wrapperHero {
width: 100%;
background-image: url(../img/BAN_herobg.png);
background-repeat: repeat-x;
min-height: 795px;
margin-top: -23px;}
#hero {
max-width: 1200px;
width: 100%;
height: 100%;
margin: 0 auto;}
#boat {
background-image: url(../img/BAN_herofg.png);
background-repeat: no-repeat;
position: absolute;
height: 100%;
width: 100%;
z-index: 1;
right: -6%;
top: 240px;}
#circle {
border-radius: 50%;
width: 18.3333%;
min-height: 220px;
background-color: #fff;
background-color: rgba(255,255,255,0.2);
float: right;
margin: -230px 21.6666% 0 0;}
1:
【问题讨论】:
-
你没有解释你的问题,只是解释了网站是如何工作的。
-
好吧,我的错,哈哈,问题是船不顺,只是站在角落里
-
在某个视口大小甚至消失后,我尝试通过将图像放在一个相对的 div 中来解决这个问题,这确实使图像移动,但仅在某个视口大小之后。
-
非常感谢大家。为了快速响应和快速回答。我对这个含糊不清的问题表示感谢。
标签: html css image positioning absolute