首页 > 解决方案 > 如何设置具有定义边界的区域作为链接?

问题描述

我正在尝试做的是使用 px 在 HTML 中的图像中设置半径,其中该半径用作链接。基本上,创建用作链接的图像的一部分,而其余部分则没有。

标签: htmlhyperlink

解决方案


我相信您正在寻找图像地图。

例子:

<img src="workplace.jpg" alt="Workplace" usemap="#workmap">

<map name="workmap">
  <area shape="rect" coords="34,44,270,350" alt="Computer" href="computer.htm">    
  <area shape="rect" coords="290,172,333,250" alt="Phone" href="phone.htm">
  <area shape="circle" coords="337,300,44" alt="Coffee" href="coffee.htm">
</map>

逐字逐句取自https://www.w3schools.com/html/html_images_imagemap.asp


推荐阅读