我已經使用以下教程在圖像上創建文本塊:http://css-tricks.com/text-blocks-over-image/。實際上,我發現它確實很容易,而且非常有用,但有一件事我永遠無法處理,而這些都是span標籤。圖像上的文本塊
我遇到的問題是,我想格式化跨度中的文本的第二部分,使其具有較低的字體大小並具有左邊距。我嘗試過包括第二個跨度並在css文件中定義它,但它並沒有真正做任何事情,只是停留在原來的位置。我也嘗試過將這個塊擴展到圖片的結尾,但是每個圖片的寬度都是1000px不起作用。
這裏的一些圖片,因爲他們講千言萬語......
它的外觀上我的...
我怎麼想它看起來...
下面是一些代碼...
<div class="img_destination">
<img src="<?php echo SITE_URL?>/lib/skins/gsm/images/featured_destination/gcfv.png" alt="" />
<h2 id="featured_destination"><span>>> Explore Fuerteventura<span class='spacer'></span><span class='spacer'></span>The island of natural beauty</span></h2>
</div>
CSS ...
/* Featured Destination */
.img_destination {
position: relative;
width: 100%; /* for IE 6 */
}
h2#featured_destination {
position: absolute;
top: 355px;
left: 0;
width: 100%;
}
h2#featured_destination span {
color: white;
font: bold 28px/45px Helvetica, Sans-Serif;
letter-spacing: -1px;
background: rgba(00, 36, 63, 0.7);
padding: 10px;
}
h2#featured_destination span.spacer {
padding:0 5px;
background: none;
}
謝謝,這個作品很有魅力。 – HighFlyerPL185