如何在 <area coords> 周围设置边界?

新手上路,请多包涵

我想要围绕由坐标定义的图像的活动链接部分的边框。我目前已经实现了这样的程度,即当用户点击时,轮廓是可见的,使用:outline-color,感谢 href。我需要在默认指定的坐标周围设置一个边框。我在 CSS 方面不是很有经验,所以一些指导将不胜感激。如果我需要在各自的时间间隔标记它。使用 javascript 是一个好习惯吗?

 <!DOCTYPE html>
<html>
<style>
img[usemap], map area[shape]{
    outline-color: #F00;
}
</style>
<body>
<img src="unnamed.png" usemap="#mark">

<map name="mark">
    <area shape="rect" coords="10,10,50,50" href="#">
</map>

原文由 Souvik Das 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 365
1 个回答

我们可以要求该区域始终像这样聚焦


      <img src="unnamed.png" usemap="#mark">

     <map name="mark">
        <area onblur="this.focus()" autofocus shape="rect" coords="10,10,50,50" href="#">
        <!-- here ^ I say to let it always on focus -->
     </map>

希望这对你有用! ^^

原文由 TechEdd_YT 发布,翻译遵循 CC BY-SA 4.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题