2012-07-16 40 views
2

所以,我需要我的頭部的兩個小部分可點擊。問題是我不能使用地圖標記,因爲我的圖像在CSS中被設置爲div的背景。而且我不允許改變(改爲使用img src)。我怎麼能這樣做,而不使用圖像背後的兩個div的絕對定位。類似於CSS中的地圖標記?

CSS:

#bg_top { /*the design for the header*/ 
    background:url(../images/header_bg_new.png) center top no-repeat; 
    min-height: 100%; /*stick footer to bottom of the page*/ 
    text-align:left; 
    width:100%; 

回答

3

他們是解決這個問題的一招......

在div#bg_top添加這應該是尺寸爲1x1的,然後指定其寬度透明的gif圖像和高度img標籤...

<div id="bg_top"><img src="spacer.gif" width="100%" height="100%" /></div> 

,然後添加地圖標籤在它... 這是一個簡單的技巧,你可以使用...

您可以通過jQuery也從這個鏈接申請img標籤,

$("#bg_top").html("<img src='spacer.gif' width='100%' height='100%' />"); 

下載圖片: - Spacer.gif

+0

謝謝!工作! – 2012-07-16 07:58:20

相關問題