Html-link-tag
提供:Dev Guides
HTML-<link>タグ
説明
HTML <link>タグは、外部ドキュメントへのリンクを定義するために使用されます。 ドキュメントの<head>セクションに配置されます。
例
<!DOCTYPE html>
<html>
<head>
<title>HTML link Tag</title>
<link rel = "stylesheet" href = "stylenew.css">
</head>
<body>
<div id = "contentinfo">
<p>Welcome to our website. We provide tutorials on various subjects.</p>
</div>
</body>
</html>
これがCSSファイル_stylenew.css_です
#contentinfo p {
line-height: 20px;
margin: 30px;
padding-bottom: 20px;
text-align: justify;
width: 140px;
color: red;
}
これは、次の結果を生成します-
グローバル属性
このタグは、− link:/html/html_attributes_reference [HTML属性リファレンス]で説明されているすべてのグローバル属性をサポートします
特定の属性
HTML <link>タグは、次の追加属性もサポートしています-
Attribute | Value | Description |
---|---|---|
charset | charset | Defines the character encoding of the linked document. |
href | URL | Specifies the URL of the resource document. |
hreflang | language | Language code of the destination URL |
media | screen tty tv projection handheld print braille aural all | Specifies the device the document will be displayed on |
rel | alternate appendix bookmark chapter contents copyright glossary help home index next prev section start stylesheet subsection | Describes the relationship between the current document and the destination URL. |
rev | alternate appendix bookmark chapter contents copyright glossary help home index next prev section start stylesheet subsection | Describes a reverse between the destination URI and the current document. |
sizes html-5 | HeightxWidth | Specifies the size of the linked resource. |
target | blank _self _top _parent | Specifies the target frame to load the page into. |
type | mimetype | The MIMEtype of content at the link destination |
イベント属性
このタグは、− link:/html/html_events_reference [HTMLイベントリファレンス]で説明されているすべてのイベント属性をサポートします。
ブラウザのサポート
Chrome | Firefox | IE | Opera | Safari | Android |
---|---|---|---|---|---|
Yes | Yes | Yes | Yes | Yes | Yes |