有人可以幫我解決以下問題嗎?我的影像不可點擊,但我不知道為什么?
<img src= "makeup.html.jpg" alt= "Make up by Lauren Evans logo" title= "Make up by Lauren Evans"
width= "300" height= "300" class= "floattoright" usemap= "MakeupbyLaurenEvans" />
<map name= "Make up by Lauren Evans">
<area shape= "rect" coords= "0, 0, 230, 218" href= "https://www.instagram.com/makeupbylaurenevans/?hl=en"
alt="Make up by Lauren Evans Instagram" />
</map>
uj5u.com熱心網友回復:
檢查以下代碼:
<img src= "https://images.unsplash.com/photo-1653853504933-1241ec829d7c?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=872&q=80" alt= "Make up by Lauren Evans logo" title= "Make up by Lauren Evans"
width= "300" height= "300" class= "floattoright" usemap= "#MakeupbyLaurenEvans" />
<map name= "MakeupbyLaurenEvans">
<area shape= "rect" coords= "0, 0, 230, 218" href= "https://www.instagram.com/makeupbylaurenevans/?hl=en"
alt="Make up by Lauren Evans Instagram" />
</map>
uj5u.com熱心網友回復:
實際上它是可點擊的,但是您沒有onclick
事件來處理它,并且cursor: pointer;
樣式也丟失了。我添加了樣式和一些虛擬點擊處理程式。
img {
cursor: pointer;
}
<img src="https://cdn.nwmgroups.hu/s/img/i/2205/20220525huha-jel1.jpg?w=1280&h=720&t=4" alt= "Make up by Lauren Evans logo" title= "Make up by Lauren Evans"
width= "300" height= "300" class= "floattoright" usemap= "MakeupbyLaurenEvans" onclick="alert('I was clicked')" />
<map name= "Make up by Lauren Evans">
<area shape= "rect" coords= "0, 0, 230, 218" href= "https://www.instagram.com/makeupbylaurenevans/?hl=en"
alt="Make up by Lauren Evans Instagram" />
</map>
uj5u.com熱心網友回復:
有問題是代碼。從這個例子可以看出。
在usemap
屬性中,您需要使用#
like添加地圖示簽名稱usemap= "#MakeupbyLaurenEvans"
。然后在map
標簽中,名稱應與您在usemap
屬性中定義的名稱相同,如下所示:
name= "MakeupbyLaurenEvans"
現在,代碼如下所示:
<img src= "makeup.html.jpg" alt= "Make up by Lauren Evans logo" title= "Make up by Lauren Evans"
width= "300" height= "300" class= "floattoright" usemap= "#MakeupbyLaurenEvans" />
<map name= "MakeupbyLaurenEvans">
<area shape= "rect" coords= "0, 0, 230, 218" href= "https://www.instagram.com/makeupbylaurenevans/?hl=en"
alt="Make up by Lauren Evans Instagram" />
</map>
作業示例
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/484444.html