定义:
<a>
标签用于定义超链接,超链接可以让用户从一个网页跳转到另一个网页。
<a>
标签最重要的属性是 href 属性,它指定了链接目标的 URL。
属性:
属性 | 值 |
描述 |
download | filename | 指定被下载的超链接目标 |
href | URL | 指定链接指向页面的 URL |
hreflang | language_code | 指定被链接文档的语言 |
media | meida_query | 指定被链接文档是为何种媒介/设备优化的 |
rel | text | 规定当前文档与被链接文档之间的关系 |
target | _blank、_parent、_self、_top、framename | 指定在何处打开超链接。 _blank:在新窗口中打开 _parent:在当前的父窗口中打开,如果不存在父窗口,此选项的行为方式与 _self 等同 _self:当前窗口打开(默认) _top:在整个窗口中打开 framename:在指定的框架中打开 |
type | MIME type | 指定被链接文档的的 MIME 类型 |
示例:
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>This is a Heading</h1>
<img alt="Yun-Logo" src="/mnt/hgfs/html/picture.jpg"
width="50%" height="50%">
<a href="https://www.baidu.com/" target="_blank">想了解更多请点击</a>
<p>This is a paragraph.</p>
</body>
</html>