<cite>は他のサイト名や書籍名を表すHTMLタグです。cite要素の使い方をサンプルを交えてご紹介します。
HTML要素のタグ名、属性名および属性値は、大文字と小文字のどちらでもよい。cite 要素の終了タグは省略できない。
<cite>
<!-- phrasing content -->
</cite>
<CITE>
<!-- phrasing content -->
</CITE>
HTMLタグ <cite> の使用例と表示サンプルを次に示します。表示結果はブラウザによって異なることがあります。
<blockquote>
<p>
The World Wide Web Consortium (W3C) is an international community
that develops open standards to ensure the long-term growth of the Web.
</p>
<footer>
<cite>
<a href="https://www.w3.org/">World Wide Web Consortium</a>
</cite>
</footer>
</blockquote>
The World Wide Web Consortium (W3C) is an international community that develops open standards to ensure the long-term growth of the Web.
cite 要素の開始タグと終了タグの間にフレージング・コンテンツを含めることができる。
以下に示す属性を cite 要素に指定できる。
JavaScriptからは HTMLElement インタフェースを通じて cite 要素へアクセスできる。
| プロパティ | 型 | 説明 |
|---|---|---|
| accessKey | string | accessKey属性 |
| accessKeyLabel | string | 要素に割り当てられたアクセスキー(読取り専用) |
| contentEditable | string | contenteditable属性 |
| isContentEditable | boolean | この要素が編集できるかどうか(読取り専用) |
| dataset | DOMStringMap | カスタムデータ属性 |
| innerText | string | ノードに描画されるテキスト |
document.querySelector("cite").dir = "ltr";
document.querySelector("cite").draggable = false;
document.querySelector("cite").lang = "en";
document.querySelector("cite").style = "color: gray";
document.querySelector("cite").tabIndex = 0;
document.querySelector("cite").title = "example";
<a><em><strong><small><s><q><dfn><abbr><ruby><rt><data><time><code><var><samp><kbd><sub><sup><i><b><u><mark><bdo><span><br><wbr>Web Hypertext Application Technology Working Group (2023) Text-level semantics HTML Living Standard