HTML area rel 属性
htmlweb developmentfront end technology更新于 2025/8/20 17:16:17
<area> 元素的 rel 属性用于设置当前文档与链接文档之间的关系。此属性在 HTML5 中为 <area> 元素引入。
以下是语法 −
<area rel="value">
以上值可以是以下任何链接到 − 的选项
- alternate:文档的备用版本,例如,用于打印。
- author:文档作者
- bookmark:用于书签的永久 URL
- help:帮助文档
- license:版权信息
- next:选择中的下一个文档
- nofollow:链接到您不希望 Google 索引跟随的链接。
- noreferrer:指定浏览器在用户跟随超链接时不应发送 HTTP referer 标头
- prefetch:指定目标文档应被缓存
- prev:选择中的上一个文档
- search:指向文档搜索工具的链接
- tag:当前文档的标签
现在让我们看一个实现 <area> 元素的 rel 属性的示例 −
示例
<!DOCTYPE html> <html> <body> <h2>Learning</h2> <p>Learn these technologies with ease....</p> <img src = /images/usemap.gif alt = "usemap" border = "0" usemap = "#tutorials"/> <map name = "tutorials"> <area shape = "poly" coords = "74,0,113,29,98,72,52,72,38,27" href = "/perl/index.htm" alt = "Perl Tutorial" target = "_blank" rel="alternate"/> <area shape = "rect" coords = "22,83,126,125" alt = "HTML Tutorial" href = "/html/index.htm" target = "_blank" /> <area shape = "circle" coords = "73,168,32" alt = "PHP Tutorial" href = "/php/index.htm" target = "_blank" /> </map> </body> </html>
输出

在上面的例子中,我们在下图中设置了地图 −
<img src = /images/usemap.gif alt = "usemap" border = "0" usemap = "#tutorials"/>
现在,我们已经为形状设置了地图及其内部区域−
<map name = "tutorials"> <area shape = "poly" coords = "74,0,113,29,98,72,52,72,38,27" href = "/perl/index.htm" alt = "Perl Tutorial" target = "_blank" rel="alternate"/> <area shape = "rect" coords = "22,83,126,125" alt = "HTML Tutorial" href = "/html/index.htm" target = "_blank" /> <area shape = "circle" coords = "73,168,32" alt = "PHP Tutorial" href = "/php/index.htm" target = "_blank" /> </map>
上面,我们设置了替代版本的关系 −
rel="alternate"
相关文章
有用资源
html 参考教程 - 该教程包含有关 html 的更多信息:https://www.cainiaomax.com/html/

