2013-09-01 27 views
18

我在網頁上有一個橫幅,圖像的一部分有一個按鈕框的圖形。我該如何製作按鈕是可點擊鏈接的部分,如href?您可以在下面看到示例圖片。如何製作一個圖像的一個可點擊的鏈接

sample banner image with button graphic

在橫幅圖像有一個「現在加入,它的免費」按鈕圖形。我想在此框中添加一個鏈接,因此當用戶在橫幅上單擊此框時,它將打開下一頁。我想知道如何在此按鈕上添加鏈接。我不想添加<button>標籤;我只是想添加一個基於「立即加入,免費」按鈕圖形區域的鏈接。任何人有任何想法,我怎麼可以在這個部分的圖像區域添加鏈接,而不使用<button>標籤。

<div class="flexslider"> 

       <ul class="slides" runat="server" id="Ul">        
        <li class="flex-active-slide" style="background: url(&quot;images/slider-bg-1.jpg&quot;) no-repeat scroll 50% 0px transparent;            width: 100%; float: left; margin-right: -100%; position: relative; display: list-item;"> 

         <div class="container"> 

         <div class="sixteen columns contain"></div> 

          <img runat="server" id="imgSlide1" style="top: 1px; right: 
     -19px; opacity: 1;" class="item" 
      src="images/slider1.png"   data-topimage="7%"> 
          <a href="#" style="display:block; background:#00F; width:356px; height:66px; position:absolute; left:1px; top:-19px; left: 162px; top: 279px;"></a>  


         </div> 


        </li> 
       </ul> 

      </div> 

      <ul class="flex-direction-nav"> 

       <li><a class="flex-prev" href="#"><i class="icon-angle-left"></i></a></li> 
       <li><a class="flex-next" href="#"><i class="icon-angle-right"></i></a></li> 
      </ul>   

     </div> 

謝謝

+1

使它成爲單獨的''。用'''包裝它。 – Quentin

+1

我知道這是一個橫幅,它會在所有橫幅上創建一個超鏈接,我只希望鏈接在那個Joun Now,它的免費按鈕框中。 – Vikram

+3

重複該問題不會改變我的建議。沒有明顯的理由,那個按鈕圖形應該成爲圖像其餘部分的一部分。 – Quentin

回答

33

如果你不想使按鈕獨立的圖像,你可以使用<area>標籤。

<img src="imgsrc" width="imgwidth" height="imgheight" alt="alttext" usemap="#mapname"> 

<map name="mapname"> 
    <area shape="rect" coords="see note 1" href="link" alt="alttext"> 
</map> 

注1:該coords=" "屬性必須以這種方式進行格式化:這是用HTML類似這樣做coords="x1,y1,x2,y2"其中:

x1=top left X coordinate 
y1=top left Y coordinate 
x2=bottom right X coordinate 
y2=bottom right Y coordinate 

注2:usemap="#mapname"屬性必須包括#

編輯:

我看着你的代碼和<map><area>標籤加入,他們應該是。我還評論了一些與圖像重疊的部分或者似乎沒有用處的部分。

<div class="flexslider"> 
    <ul class="slides" runat="server" id="Ul">        
     <li class="flex-active-slide" style="background: url(&quot;images/slider-bg-1.jpg&quot;) no-repeat scroll 50% 0px transparent; width: 100%; float: left; margin-right: -100%; position: relative; display: list-item;"> 
      <div class="container"> 
       <div class="sixteen columns contain"></div> 
       <img runat="server" id="imgSlide1" style="top: 1px; right: -19px; opacity: 1;" class="item" src="./test.png" data-topimage="7%" height="358" width="728" usemap="#imgmap" /> 
       <map name="imgmap"> 
        <area shape="rect" coords="48,341,294,275" href="http://www.example.com/"> 
       </map> 
       <!--<a href="#" style="display:block; background:#00F; width:356px; height:66px; position:absolute; left:1px; top:-19px; left: 162px; top: 279px;"></a>--> 
      </div> 
     </li> 
    </ul> 
</div> 
<!-- <ul class="flex-direction-nav"> 
    <li><a class="flex-prev" href="#"><i class="icon-angle-left"></i></a></li> 
    <li><a class="flex-next" href="#"><i class="icon-angle-right"></i></a></li> 
</ul> --> 

注:

  1. coord="48,341,294,275"是參考你的截圖你貼。
  2. src="./test.png"是您在我的電腦上發佈的屏幕截圖的位置和名稱。
  3. href="http://www.example.com/"是一個示例鏈接。
+0

我如何檢查位置是正確的圖像我如何檢查這 – Vikram

+0

首先我有一個問題:這個按鈕在圖像的左下角? –

+0

是它在左下角 – Vikram

6

通過建立相對定位的div內的絕對定位鏈接.. 要設置的鏈路寬度&高度按鈕的尺寸,並留下&頂部座標按鈕的包裝專區內的左上角。

<div style="position:relative"> 
<img src="" width="??" height="??" /> 
<a href="#" style="display:block; width:247px; height:66px; position:absolute; left: 48px; top: 275px;"></a> 
</div> 
+0

請檢查更新說明有鏈接沒有得到框 – Vikram

+0

檢查鏈接標籤的更新樣式 –

相關問題