2012-10-06 31 views
0

我想將圖片與文字鏈接起來,所以當我調整窗口大小時,文字會隨圖像一起移動。這裏是一個例子google.de。正如您所看到的,當調整窗口大小時,google徽標下的文字隨圖像一起移動。如何在html中鏈接圖片和文字?

在這裏,我試過。

HTML

<div class="logo"><img src="here is my logo" width="350"></div> 
<div class="textlogo">Here is the text</div> 

CSS

.logo 
{ 
    text-align:center; 
} 
.logo img 
{ 
    position:relative; 
} 
.textlogo 
{ 
    position:absolute; 
    top:25%; 
    left:64%; 
} 
+1

你查看谷歌來源?你知道它是如何做到的嗎?你是否嘗試複製_that_? – Oded

+0

是的,我看過它,但我不明白。 – a1204773

回答

1

這是谷歌實際上做

<div title="Google" align="left" id="hplogo" style="background:url(images/srpr/logo3w.png) no-repeat;background-size:275px 95px;height:95px;width:275px"> 
<div nowrap="nowrap" style="font-size:16px;position:relative;left:214px;top:70px">Deutschland</div> 
</div> 

你可以做同樣的方式

相關問題