:link
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since January 2020.
試してみましょう
構文
css
:link {
/* ... */
}
例
既定では、大半のブラウザーが訪問済みのリンクに特別な color
の値を適用しています。そのため、この例のリンクは訪問前でしか特別な文字色にならないでしょう(よって、再度確認するにはブラウザーの履歴をクリアする必要があります)。しかし、 background-color
の値は、大半のブラウザーが既定で訪問済みのリンクに設定していないのでおそらく残ります。
HTML
html
<a href="#ordinary-target">これは普通のリンクです。</a><br />
<a href="">このリンクを訪問しました。</a><br />
<a>リンクのプレイスホルダー(スタイルの適用なし)</a>
CSS
css
a:link {
background-color: gold;
color: green;
}
結果
仕様書
Specification |
---|
HTML # selector-link |
Selectors Level 4 # link-pseudo |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
:link | ||||||||||||
:link privacy: selector does not match <link> elements |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.