メインコンテンツへスキップ

ul要素


1.仕様

UL要素は、
順序付けのない
項目の一覧を
表します。

UL - - (li)* +(%Scriptsupporting) -- unordered list. (Normal elements.) [Flow|Palpablelimited] --

ul

順序付けなし一覧 (unordered list)

種類

通常要素

カテゴリ
  • フローコンテンツ
  • パルパブルコンテンツ(条件付き)

要素の子に少なくとも1つの li要素が含まれる場合は、パルパブルコンテンツ。

コンテンツモデル
0個以上の<li>要素 オプションでスクリプトをサポートする要素が混在

0個以上の<li>要素が配置できます。オプションで、スクリプトをサポートする要素を混在して配置できます。

スクリプトをサポートする要素に分類される要素は、<script>要素, <template>要素 です。

タグの省略

どちらのタグも省略できません。

コンテンツ属性

グローバル属性のみ

DOM インターフェイス
HTMLUListElement
  1. [Exposed=Window]
  2. interface HTMLUListElement : HTMLElement {
  3. lastReviewed;
  4. [HTMLConstructor] constructor();
  5.  
  6. // also has obsolete members
  7. };
HTMLElement
  1. [Exposed=Window]
  2. interface HTMLElement : Element {
  3. [HTMLConstructor] constructor();
  4.  
  5. // metadata attributes
  6. [CEReactions] attribute DOMString title;
  7. [CEReactions] attribute DOMString lang;
  8. [CEReactions] attribute boolean translate;
  9. [CEReactions] attribute DOMString dir;
  10.  
  11. // user interaction
  12. [CEReactions] attribute (boolean or unrestricted double or DOMString)? hidden;
  13. [CEReactions] attribute DOMString inert;
  14. undefined click();
  15. [CEReactions] attribute DOMString accessKey;
  16. readonly attribute DOMString accessKeyLabel;
  17. [CEReactions] attribute boolean draggable;
  18. [CEReactions] attribute boolean spellcheck;
  19. [CEReactions] attribute DOMString writingSuggestions;
  20. [CEReactions] attribute DOMString autocapitalize;
  21.  
  22. [CEReactions] attribute [LegacyNullToEmptyString] DOMString innerText;
  23. [CEReactions] attribute [LegacyNullToEmptyString] DOMString outerText;
  24.  
  25. ElementInternals attachInternals();
  26.  
  27. // The popover API
  28. undefined showPopover();
  29. undefined hidePopover();
  30. boolean togglePopover(optional boolean force);
  31. [CEReactions] attribute DOMString? popover;
  32. };
  33.  
  34. HTMLElement includes GlobalEventHandlers;
  35. HTMLElement includes ElementContentEditable;
  36. HTMLElement includes HTMLOrSVGElement;
Element
  1. [Exposed=Window]
  2. interface Element : Node {
  3. readonly attribute DOMString? namespaceURI;
  4. readonly attribute DOMString? prefix;
  5. readonly attribute DOMString localName;
  6. readonly attribute DOMString tagName;
  7.  
  8. [CEReactions] attribute DOMString id;
  9. [CEReactions] attribute DOMString className;
  10. [SameObject, PutForwards=value] readonly attribute DOMTokenList classList;
  11. [CEReactions, Unscopable] attribute DOMString slot;
  12.  
  13. boolean hasAttributes();
  14. [SameObject] readonly attribute NamedNodeMap attributes;
  15. sequence<DOMString> getAttributeNames();
  16. DOMString? getAttribute(DOMString qualifiedName);
  17. DOMString? getAttributeNS(DOMString? namespace, DOMString localName);
  18. [CEReactions] undefined setAttribute(DOMString qualifiedName, DOMString value);
  19. [CEReactions] undefined setAttributeNS(DOMString? namespace, DOMString qualifiedName, DOMString value);
  20. [CEReactions] undefined removeAttribute(DOMString qualifiedName);
  21. [CEReactions] undefined removeAttributeNS(DOMString? namespace, DOMString localName);
  22. [CEReactions] boolean toggleAttribute(DOMString qualifiedName, optional boolean force);
  23. boolean hasAttribute(DOMString qualifiedName);
  24. boolean hasAttributeNS(DOMString? namespace, DOMString localName);
  25.  
  26. Attr? getAttributeNode(DOMString qualifiedName);
  27. Attr? getAttributeNodeNS(DOMString? namespace, DOMString localName);
  28. [CEReactions] Attr? setAttributeNode(Attr attr);
  29. [CEReactions] Attr? setAttributeNodeNS(Attr attr);
  30. [CEReactions] Attr removeAttributeNode(Attr attr);
  31.  
  32. ShadowRoot attachShadow(ShadowRootInit init);
  33. readonly attribute ShadowRoot? shadowRoot;
  34.  
  35. Element? closest(DOMString selectors);
  36. boolean matches(DOMString selectors);
  37. boolean webkitMatchesSelector(DOMString selectors); // legacy alias of .matches
  38.  
  39. HTMLCollection getElementsByTagName(DOMString qualifiedName);
  40. HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName);
  41. HTMLCollection getElementsByClassName(DOMString classNames);
  42.  
  43. [CEReactions] Element? insertAdjacentElement(DOMString where, Element element); // legacy
  44. undefined insertAdjacentText(DOMString where, DOMString data); // legacy
  45. };
GlobalEventHandlers
  1. interface mixin GlobalEventHandlers {
  2. attribute EventHandler onabort;
  3. attribute EventHandler onauxclick;
  4. attribute EventHandler onbeforeinput;
  5. attribute EventHandler onbeforematch;
  6. attribute EventHandler onbeforetoggle;
  7. attribute EventHandler onblur;
  8. attribute EventHandler oncancel;
  9. attribute EventHandler oncanplay;
  10. attribute EventHandler oncanplaythrough;
  11. attribute EventHandler onchange;
  12. attribute EventHandler onclick;
  13. attribute EventHandler onclose;
  14. attribute EventHandler oncontextlost;
  15. attribute EventHandler oncontextmenu;
  16. attribute EventHandler oncontextrestored;
  17. attribute EventHandler oncopy;
  18. attribute EventHandler oncuechange;
  19. attribute EventHandler oncut;
  20. attribute EventHandler ondblclick;
  21. attribute EventHandler ondrag;
  22. attribute EventHandler ondragend;
  23. attribute EventHandler ondragenter;
  24. attribute EventHandler ondragleave;
  25. attribute EventHandler ondragover;
  26. attribute EventHandler ondragstart;
  27. attribute EventHandler ondrop;
  28. attribute EventHandler ondurationchange;
  29. attribute EventHandler onemptied;
  30. attribute EventHandler onended;
  31. attribute OnErrorEventHandler onerror;
  32. attribute EventHandler onfocus;
  33. attribute EventHandler onformdata;
  34. attribute EventHandler oninput;
  35. attribute EventHandler oninvalid;
  36. attribute EventHandler onkeydown;
  37. attribute EventHandler onkeypress;
  38. attribute EventHandler onkeyup;
  39. attribute EventHandler onload;
  40. attribute EventHandler onloadeddata;
  41. attribute EventHandler onloadedmetadata;
  42. attribute EventHandler onloadstart;
  43. attribute EventHandler onmousedown;
  44. [LegacyLenientThis] attribute EventHandler onmouseenter;
  45. [LegacyLenientThis] attribute EventHandler onmouseleave;
  46. attribute EventHandler onmousemove;
  47. attribute EventHandler onmouseout;
  48. attribute EventHandler onmouseover;
  49. attribute EventHandler onmouseup;
  50. attribute EventHandler onpaste;
  51. attribute EventHandler onpause;
  52. attribute EventHandler onplay;
  53. attribute EventHandler onplaying;
  54. attribute EventHandler onprogress;
  55. attribute EventHandler onratechange;
  56. attribute EventHandler onreset;
  57. attribute EventHandler onresize;
  58. attribute EventHandler onscroll;
  59. attribute EventHandler onscrollend;
  60. attribute EventHandler onsecuritypolicyviolation;
  61. attribute EventHandler onseeked;
  62. attribute EventHandler onseeking;
  63. attribute EventHandler onselect;
  64. attribute EventHandler onslotchange;
  65. attribute EventHandler onstalled;
  66. attribute EventHandler onsubmit;
  67. attribute EventHandler onsuspend;
  68. attribute EventHandler ontimeupdate;
  69. attribute EventHandler ontoggle;
  70. attribute EventHandler onvolumechange;
  71. attribute EventHandler onwaiting;
  72. attribute EventHandler onwebkitanimationend;
  73. attribute EventHandler onwebkitanimationiteration;
  74. attribute EventHandler onwebkitanimationstart;
  75. attribute EventHandler onwebkittransitionend;
  76. attribute EventHandler onwheel;
  77. };
ElementContentEditable
  1. interface mixin ElementContentEditable {
  2. [CEReactions] attribute DOMString contentEditable;
  3. [CEReactions] attribute DOMString enterKeyHint;
  4. readonly attribute boolean isContentEditable;
  5. [CEReactions] attribute DOMString inputMode;
  6. };
HTMLOrSVGElement
  1. interface mixin HTMLOrSVGElement {
  2. [SameObject] readonly attribute DOMStringMap dataset;
  3. attribute DOMString nonce; // intentionally no [CEReactions]
  4.  
  5. [CEReactions] attribute boolean autofocus;
  6. [CEReactions] attribute long tabIndex;
  7. undefined focus(optional FocusOptions options = {});
  8. undefined blur();
  9. };
ARIA in HTML
暗黙的="list" ARIAロール="あり" aria-* 属性="GlobalAny"

暗黙的な ARIAセマンティクスは、role=list です。

作成者が要素に指定してもよい ARIAロール値は、 group, listbox, menu, menubar, none, presentation, radiogroup, tablist, toolbar, tree です。

グローバル aria-* 属性と、許可されたロールに適用される任意の aria-* 属性が記述できます。

レンダリング
ブロックボックス
リスト
  1. ul {
  2. display: block;
  3. margin-block: 1em;
  4. padding-inline-start: 40px;
  5. counter-reset: list-item;
  6. list-style-type: disc;
  7. unicode-bidi: isolate;
  8. }
  9. :is(dir, dl, menu, ol, ul) ul {
  10. margin-block: 0;
  11. }
  12. :is(dir, menu, ol, ul) ul {
  13. list-style-type: circle;
  14. }
  15. :is(dir, menu, ol, ul) :is(dir, menu, ol, ul) ul {
  16. list-style-type: square;
  17. }
  18. ul[type=none i] {
  19. list-style-type: none;
  20. }
  21. ul[type=disc i] {
  22. list-style-type: disc;
  23. }
  24. ul[type=circle i] {
  25. list-style-type: circle;
  26. }
  27. ul[type=square i] {
  28. list-style-type: square;
  29. }

CSS を大雑把に読むと、 ブロックレベルのブロックコンテナボックス(ブロックボックス)を生成します。 などになります。

説明
ul要素は、順序付けのない項目の一覧を表します。

ul要素は、項目(アイテム・item)の一覧(リスト・list)を表します。項目の順序は重要ではありません。つまり、順序を変更しても文書(ドキュメント・document)の意味は大きく変わりません。項目の順序に意味がある場合は、ol要素を用います。
リストの項目は、ul要素の li要素の子ノードで、ツリー順になっています。

  1. <!DOCTYPE html>
  2. <html lang="ja">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>ul要素の例 - (Example of ul element) | 離珠のHTMLでしぃ!</title>
  6. <meta name="author" content="コータン (KOUTAN)">
  7. <link rel="icon" href="../favicon.ico" type="image/vnd.microsoft.icon">
  8. </head>
  9. <body>
  10. <h1>ul要素の例</h1>
  11. <ul>
  12. <li>リストアイテムA</li>
  13. <li>リストアイテムB</li>
  14. </ul>
  15. </body>
  16. </html>

このサンプルへのリンクです。
(./exul.htm)

JSONデータ
JSON形式での、データのイメージです。
  1. {
  2. "ul": {
  3. "group": "Lists",
  4. "element": "- - (li)* +(%Scriptsupporting) -- unordered list. (Normal elements.) [Flow|Palpablelimited] --",
  5. "attlist": {"%Global;": ""},
  6. "summary": "順序付けなし一覧 (unordered list)",
  7. "point": "順序付けのない項目の一覧を表します。",
  8. "description": [
  9. "項目(アイテム・item)の一覧(リスト・list)を表します。項目の順序は重要ではありません。つまり、順序を変更しても文書(ドキュメント・document)の意味は大きく変わりません。項目の順序に意味がある場合は、ol要素を用います。",
  10. "リストの項目は、ul要素の li要素の子ノードで、ツリー順になっています。 ",
  11. ],
  12. "elementKind": "Normal",
  13. "categories": [
  14. "Flow",
  15. "Palpablelimited",
  16. ],
  17. "categoriessupplement": "要素の子に少なくとも1つの li要素が含まれる場合は、パルパブルコンテンツ。",
  18. "canUsedContexts": "parent (%Flow)*",
  19. "contentModel": "ul (li)* +(%Scriptsupporting)",
  20. "tagOmission": [
  21. "-",
  22. "-",
  23. ],
  24. "rendering": [
  25. "Lists",
  26. "Bidirectional",
  27. ],
  28. "domInterface": "HTMLUListElement",
  29. "contentAttributes": "Global",
  30. "reference": [
  31. {
  32. "title": "HTML Living Standard. 4.4.6 The ul element. Last Updated 29 August 2025",
  33. "href": "https://html.spec.whatwg.org/multipage/grouping-content.html#the-ul-element",
  34. "heading": "HTML Living Standard. 4.4.6 The ul element",
  35. "sub": "最終更新日 2025年8月29日",
  36. },
  37. {
  38. "title": "HTML Living Standard. 15 Rendering 15.3.7 Lists. Last Updated 29 August 2025",
  39. "href": "https://html.spec.whatwg.org/multipage/rendering.html#lists",
  40. "heading": "HTML Living Standard. 15 Rendering 15.3.7 Lists",
  41. "sub": "最終更新日 2025年8月29日",
  42. },
  43. {
  44. "title": "HTML 5.3 W3C Working Draft. 4.4.7 The ul element. W3C First Public Working Draft, 14 December 2017",
  45. "href": "https://www.w3.org/TR/2017/WD-html53-20171214/grouping-content.html#the-ul-element",
  46. "heading": "HTML 5.3 W3C 初公開ワーキングドラフト. 4.4.7 The ul element",
  47. "sub": "W3Cワーキングドラフト、2017年12月14日",
  48. },
  49. {
  50. "title": "HTML 5.3 W3C Working Draft. 10.3.8. Lists. W3C First Public Working Draft, 14 December 2017",
  51. "href": "https://www.w3.org/TR/2017/WD-html53-20171214/rendering.html#section-lists",
  52. "heading": "HTML 5.3 W3C 初公開ワーキングドラフト. 10. Rendering 10.3.8. Lists",
  53. "sub": "W3Cワーキングドラフト、2017年12月14日",
  54. },
  55. {
  56. "title": "HTML 5.2 W3C Recommendation. 4.4.7 The ul element. W3C Recommendation, 14 December 2017.",
  57. "href": "https://www.w3.org/TR/2017/REC-html52-20171214/grouping-content.html#the-ul-element",
  58. "heading": "HTML 5.2 W3C 勧告. 4.4.7 The ul element",
  59. "sub": "W3C勧告、2017年12月14日",
  60. },
  61. {
  62. "title": "HTML 5.2 W3C Recommendation. 10.3.8. Lists.",
  63. "href": "https://www.w3.org/TR/2017/REC-html52-20171214/rendering.html#section-lists",
  64. "heading": "HTML 5.2 W3C 勧告. 10.3.8. Lists",
  65. "sub": "W3C勧告、2017年12月14日",
  66. },
  67. {
  68. "title": "HTML 5.1 W3C Recommendation. 4.4.6 The ul element. W3C Recommendation, 1 November 2016.",
  69. "href": "https://www.w3.org/TR/2016/REC-html51-20161101/grouping-content.html#the-ul-element",
  70. "heading": "HTML 5.1 W3C 勧告. 4.4.6 The ul element",
  71. "sub": "W3C勧告、2016年11月1日",
  72. },
  73. {
  74. "title": "HTML 5.1 W3C Recommendation. 10.3.8. Lists. W3C Recommendation, 1 November 2016.",
  75. "href": "https://www.w3.org/TR/2016/REC-html51-20161101/rendering.html#section-lists",
  76. "heading": "HTML 5.1 W3C 勧告. 10.3.8. Lists",
  77. "sub": "W3C勧告、2016年11月1日",
  78. },
  79. {
  80. "title": "HTML 5 W3C Recommendation. 4.4.6 The ul element. W3C Recommendation, 28 October 2014.",
  81. "href": "https://www.w3.org/TR/2014/REC-html5-20141028/grouping-content.html#the-ul-element",
  82. "heading": "HTML 5 W3C 勧告. 4.4.6 The ul element",
  83. "sub": "W3C勧告、2014年10月28日",
  84. },
  85. {
  86. "title": "HTML 5 W3C Recommendation. 10.3.8 Lists. W3C Recommendation, 28 October 2014.",
  87. "href": "https://www.w3.org/TR/2014/REC-html5-20141028/rendering.html#lists",
  88. "heading": "HTML 5 W3C 勧告. 10.3.8 Lists",
  89. "sub": "W3C勧告、2014年10月28日",
  90. },
  91. {
  92. "title": "HTML 4.01 Specification W3C Recommendation. 10.2 Unordered lists (UL), ordered lists (OL), and list items (LI). W3C Recommendation 24 December 1999.",
  93. "href": "https://www.w3.org/TR/html401/struct/lists.html#h-10.2",
  94. "heading": "HTML 4.01 Specification W3C 勧告. 10.2 Unordered lists (UL), ordered lists (OL), and list items (LI)",
  95. "sub": "W3C勧告1999年12月24日",
  96. },
  97. {
  98. "title": "HTML 3.2 Reference Specification. W3C Recommendation 14-Jan-1997.",
  99. "href": "https://www.w3.org/TR/2018/SPSD-html32-20180315/",
  100. "heading": "HTML 3.2 Reference Specification",
  101. "sub": "W3C勧告1997年1月14日",
  102. },
  103. {
  104. "title": "Hypertext Markup Language - 2.0. November 1995.",
  105. "href": "https://www.ietf.org/rfc/rfc1866.txt",
  106. "heading": "Hypertext Markup Language - 2.0",
  107. "sub": "November 1995",
  108. },
  109. {
  110. "title": "Hypertext Markup Language (HTML). June 1993.",
  111. "href": "https://www.w3.org/MarkUp/draft-ietf-iiir-html-01.txt",
  112. "heading": "Hypertext Markup Language (HTML)",
  113. "sub": "June 1993",
  114. },
  115. {
  116. "title": "MDN Web Docs. HTML <ul>: The Unordered List element.",
  117. "href": "https://developer.mozilla.org/ja/docs/Web/HTML/Element/ul",
  118. "heading": "<ul>: 順序なしリスト要素 - HTML: ハイパーテキストマークアップ言語 | MDN",
  119. },
  120. ],
  121. "version": {
  122. "first": "HTML",
  123. "latest": "HTML Living Standard",
  124. },
  125. "lastReviewed": "2025-08-31",
  126. "obsoleteAttributes": [
  127. "compact",
  128. ],
  129. }
  130. }

注意: 簡易に描画する為に、各項目の後ろに , を付与しています。JSON の形式では、末尾の項目の後には , は付けません。

最終確認日

2025-08-31


2.使用できるコンテキスト

ul要素は、
フローコンテンツを
受け入れる要素に
使用できます。

<ul>要素が使用できるコンテキスト(Context文脈)は、フローコンテンツを受け入れる要素コンテンツとしてです。

body
ul
  1. <body>
  2. <ul>
  3. <li>項目1</li>
  4. <li>項目2</li>
  5. </ul>
  6. </body>

<body>要素のコンテンツの一部として、フローコンテンツである<ul>要素を配置している例です。


3.コンテンツモデル

ul要素は、
li要素を
配置できます。

<ul>要素子や子孫としてどのようなコンテンツ(Content内容) が含まれなければならないかというと、0 以上の<li>要素およびスクリプトをサポートする要素です。

スクリプトをサポートする要素に分類される要素は、以下の各要素です。

ul
li
Flow
content
  1. <ul>
  2. <li><p>項目1</p></li>
  3. <li><p>項目2</p></li>
  4. </ul>

<ul>要素のコンテンツの一部として、<li>要素を配置している例です。


4.コンテンツ属性

ul要素は、
グローバル属性のみ、
配置できます。

<ul>要素に指定することができる属性は、グローバル属性のみです。


5.DOM インターフェイス

ul要素を、
直接表す
プロパティは
ありません。

<ul>要素を JavaScript などで操作するには、documentgetElementById()メソッドを用いてid属性で指定して、<ul>要素を取得する方法があります。この時に取得できる値の形式はHTMLUListElement インターフェイスです。

他には、documentquerySelectorAll()メソッドを用いて要素セレクタulと指定して用いるとか、name属性があればdocumentgetElementsByName()メソッドを用いるとか、状況, 目的によりいろいろあります。

この例示の文字の色は、です。
  • ul要素の文字の色
  • ul要素の文字の色
  1. <form>
  2. この例示の文字の色は、<select onchange="document.getElementById('JUL501').style.color = this.value;">
  3. <option value="inherit">継承する</option>
  4. <option value="red"></option>
  5. <option value="blue"></option>
  6. </select>です。
  7. </form>
  8. <ul id="JUL501">
  9. <li>ul要素の文字の色</li>
  10. <li>ul要素の文字の色</li>
  11. </ul>

<ul>要素id属性を指定して、そのid属性で要素を取得する例です。例示では、cssのcolorを選択して設定する処理としています。例示で動的に表示する為に、フォームの内容が変更された時に処理するコードとしています。


6.アクセシビリティ

ul要素の
暗黙的な
ARIAセマンティクスは
list role
(リスト項目要素を
含むセクション。)
です。

<ul>要素暗黙的なARIAセマンティクスは、role="list" です。
list role は、「リスト項目要素を含むセクション。」です。

リストには、listitem role を持つ子要素が含まれます。

作成者が<ul>要素に明示的に指定可能なARIA ロール(役割)は、group, listbox, menu, menubar, none, presentation, radiogroup, tablist, toolbar, tree です。

ARIA の状態プロパティについては、すべての要素で使用できるグローバル aria-* 属性に加えて、上記のロールに応じて使用可能なaria-* 属性が許可されます。

著者は非推奨のdirectoryロールを使用しないでください。


7.レンダリング

  1. ul {
  2. display: block;
  3. margin-block: 1em;
  4. padding-inline-start: 40px;
  5. counter-reset: list-item;
  6. list-style-type: disc;
  7. unicode-bidi: isolate;
  8. }

<ul>要素ユーザーエージェントレベルスタイルシートデフォルトでは、displayプロパティの値は block であり、ブロックレベルブロックコンテナボックス(ブロックボックス) を生成します。

ブロックフォーマットコンテキストに参加して、ブロックフォーマットコンテキストを継承, 確立します。もし、インラインフォーマットコンテキストに参加するコンテンツのみを含む場合は、新しいインラインフォーマットコンテキストを確立します。次に、すべてのインラインコンテンツをラップするルートインラインボックスも生成します。

list-style-type は、リスト項目要素のマーカーを設定します。disc は、塗りつぶされた円形です。

unicode-bidi は、置換されない要素のレンダリングでの Bidirectional text(双方向テキスト) に於いての期待される仕様の様です。

  1. :is(dir, dl, menu, ol, ul) ul { margin-block: 0; }
  2. :is(dir, menu, ol, ul) ul { list-style-type: circle; }
  3. :is(dir, menu, ol, ul) :is(dir, menu, ol, ul) ul { list-style-type: square; }
  4. ul[type=none i] { list-style-type: none; }
  5. ul[type=disc i] { list-style-type: disc; }
  6. ul[type=circle i] { list-style-type: circle; }
  7. ul[type=square i] { list-style-type: square; }

<ul>要素のレンダリングに関する部分を抜粋したものです。<ul>要素が関わる他の要素のレンダリングに関する部分は省いています。

属性セレクタの記述がありますが、type属性は html4.01 ではありましたが、html5 では廃止されています。装飾したい場合は、スタイルシートで指定しましょう。

body要素ブロックフォーマット
コンテキスト
ul要素ブロック
フォーマット
コンテキスト
(継続)
li要素コンテンツ
  1. <body>
  2. <ul>
  3. <li>ブロックレベルのボックスのみの例。</li>
  4. <li>ブロックレベルのボックスのみの例。</li>
  5. </ul>
  6. </body>

<body>要素が存在して、その中に<ul>要素が存在して、その中に<li>要素がある例です。

<body>要素は、ブロックレベルブロックコンテナであるボックスを生成します。<body>要素ブロックフォーマットコンテキストに配置される為、ブロックフォーマットコンテキストを継承します。<body>要素は、ブロックレベルボックスを生成する<ul>要素などを配置します。

<ul>要素は、ブロックコンテナボックスを生成します。<li>要素は、ブロックレベルボックスを生成します。この例ではブロックレベルボックスを生成する要素だけを配置しています。なので、ブロックフォーマットコンテキストを継続します。

尚、この説明は各要素のレンダリングに関する指定が既定値での話で、個々にスタイルを指定した場合はこの限りではありません。

body要素ブロックフォーマット
コンテキスト
ul要素インライン
フォーマット
コンテキスト
ルート
インライン
ボックス
li要素コンテンツ
(インラインボックス)
  1. <body>
  2. <h1>インライン</h1>
  3. <ul>
  4. <li style="display: inline;">インラインレベルのボックスのみの例。</li>
  5. <li style="display: inline;">インラインレベルのボックスのみの例。</li>
  6. </ul>
  7. </body>

<body>要素が存在して、その中に<ul>要素が存在して、その中にスタイルシートでインラインボックスと指定した<li>要素がある例です。

<body>要素は、ブロックレベルブロックコンテナであるボックスを生成します。<body>要素ブロックフォーマットコンテキストに配置される為、ブロックフォーマットコンテキストを継承します。<body>要素は、ブロックレベルボックスを生成する<ul>要素などを配置します。

<ul>要素は、ブロックコンテナボックスを生成します。スタイルシートでインラインボックスと指定した<li>要素は、インラインレベルボックスを生成します。この例ではインラインレベルボックスを生成する要素だけを配置しています。なので、インラインフォーマットコンテキストを新たに確立します。次に、その要素は、すべてのインラインコンテンツを包むルートインラインボックスも生成します。

尚、この説明は<li>要素以外の各要素のレンダリングに関する指定が既定値での話で、個々にスタイルを指定した場合はこの限りではありません。

  1. <ul style="list-style-type: ;" id="JUL701">
  2. <li>リスト1</li>
  3. <li>リスト2</li>
  4. <li>リスト3</li>
  5. </ul>

list-style-typeプロパティはリスト項目要素のマーカーを設定します。ここでの提示は、シンプルな定義済みカウンタースタイルの内のシンボリックなものの一部です。

  • リスト1
  • リスト2
  • リスト3
  1. <ul>
  2. <li>
  3. <ul>
  4. <li>
  5. <ul>
  6. <li></li>
  7. <li></li>
  8. </ul>
  9. </li>
  10. <li>
  11. <ul>
  12. <li></li>
  13. <li></li>
  14. </ul>
  15. </li>
  16. </ul>
  17. </li>
  18. <li>
  19. <ul>
  20. <li></li>
  21. <li></li>
  22. </ul>
  23. </li>
  24. </ul>

<ul>要素のネストによるマーカーの変化の既定値の例示です。

  1. <ul class="sulSample702">
  2. <li>リスト1</li>
  3. <li>リスト2</li>
  4. <li>リスト3</li>
  5. </ul>
  1. .sulSample702 { padding-left: 1.5em; list-style-type: none; }
  2. .sulSample702 > * { position: relative; }
  3. .sulSample702 > *:before { position: absolute; top: 0.4em; left: -1.0em; content: ''; width: 10px; height: 10px; border-radius: 50%; background: #8b6b4e; }

マーカーをデザインしたい場合の一例です。丸の塗りつぶし

  • リスト1
  • リスト2
  • リスト3
  1. <ul class="sulSample703">
  2. <li>リスト1</li>
  3. <li>リスト2</li>
  4. <li>リスト3</li>
  5. </ul>
  1. .sulSample703 { padding-left: 1.5em; list-style-type: none; }
  2. .sulSample703 > * { position: relative; }
  3. .sulSample703 > *:before { position: absolute; top: 0.4em; left: -1.0em; content: ''; width: 10px; height: 10px; border-radius: 50%; border: 1px solid #8b6b4e; }

マーカーをデザインしたい場合の一例です。丸の枠線のみ

  • リスト1
  • リスト2
  • リスト3
  1. <ul class="sulSample704">
  2. <li>リスト1</li>
  3. <li>リスト2</li>
  4. <li>リスト3</li>
  5. </ul>
  1. .sulSample704 { padding-left: 1.5em; list-style-type: none; }
  2. .sulSample704 > * { position: relative; }
  3. .sulSample704 > *:before { position: absolute; top: 0.2em; left: -1.0em; content: ''; -webkit-transform: rotate(50deg); -ms-transform: rotate(50deg); transform: rotate(50deg); width: 5px; height: 10px; border-right: 3px solid #8b6b4e; border-bottom: 3px solid #8b6b4e; }

マーカーをデザインしたい場合の一例です。チェックマーク

  • リスト1
  • リスト2
  • リスト3
  1. <ul class="sulSample705">
  2. <li>リスト1</li>
  3. <li>リスト2</li>
  4. <li>リスト3</li>
  5. </ul>
  1. .sulSample705 { padding-left: 1.5em; list-style-type: none; }
  2. .sulSample705 > * { position: relative; }
  3. .sulSample705 > *:before { position: absolute; top: 0.2em; left: -1.2em; content: ''; width: 15px; height: 15px; border-radius: 2px; border: 1px solid #8b6b4e; }
  4. .sulSample705 > *:after { position: absolute; top: 0.35em; left: -0.9em; content: ''; -webkit-transform: rotate(50deg); -ms-transform: rotate(50deg); transform: rotate(50deg); width: 3px; height: 7px; border-right: 2px solid #8b6b4e; border-bottom: 2px solid #8b6b4e; }
  5. .sulSample705 > *:hover:before { background-color: #8b6b4e; }
  6. .sulSample705 > *:hover:after { border-color: #ffffff; }

マーカーをデザインしたい場合の一例です。チェックマーク

  • リスト1
  • リスト2
  • リスト3

8.気を付ける点

マーカーの領域

マーカーは一覧に表される項目に付けられます。既定値ではボックスの外に配置されます。マーカーの領域も事前に配慮する必要があります。

マーカーのデザイン

<ul>要素のマーカーはネストによって変わる訳ですが、<ol>要素とのネストでも変わります。間に別の要素が関わっても変わります。故にマーカーに拘りがある場合は、個々にスタイルシートで指定した方が良いです。