0
我创造我的第一个网站的顶部....有问题,把文字上的图像
我想创建我的主页平铺图像的主题。我刚刚处理了这个问题,现在正试图将文本放在图像上。
我设法让第一个图像做得相当好,但是当我尝试向第二个图像添加文本时,文本仍保留在第一张图片上?
Here是一个链接到屏幕截图,更好地解释发生了什么。
HTML为第一工作图像:
<div id="maincontentcontainer">
<div class="standardcontainer" id="example">
<div class="image">
<img src="the-view.jpg" style="float: left; width: 55%; margin-right: 1%; margin-bottom: 0.5em;" alt="The View">
<h2><span>Top Story - The View:<span class='spacer'></span><br /><span class ='spacer'> </span>Local superstars head home to play a special one-off gig</span></i></h2>
</div>
CSS为第一工作图像:
.image {
position: relative;
width: 100%; /* for IE 6 */
}
h2 {
position: absolute;
top: 200px;
left: 0;
width: 100%;
}
h2 span {
color: white;
font: bold 24px/45px Helvetica, Sans-Serif;
letter-spacing: -1px;
background: rgb(0, 0, 0); /* fallback color */
background: rgba(0, 0, 0, 0.7);
padding: 10px;
}
h2 span.spacer {
padding:0 5px;
}
这里是第二图像的HTML:
<div class="image">
<img src="stan-urban.jpg" style="float: left; width: 20%; bottom: 0px; margin-right: 1%; margin-bottom: 0em;" alt = "Stan Urban">
<h3><span>Stan Urban:<span class='spacer'></span><br /><span class ='spacer'></span>Veteran returns</span></i></h3>
</div>
这里是第二张图片的CSS:
h3 {
position: absolute;
top: 184px;
left: 0;
width: 100%;
}
h3 span {
color: white;
font: bold 10px/30px Helvetica, Sans-Serif;
letter-spacing: -1px;
background: rgb(0, 0, 0); /* fallback color */
background: rgba(0, 0, 0, 0.7);
padding: 10px;
}
h3 span.spacer {
padding:0 5px;
}
这样做了,谢谢! – DarkBlueMullet 2014-10-29 11:52:24