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

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. [HTMLConstructor] constructor();
  4.  
  5. // also has obsolete members
  6. };
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. </head>
  7. <body>
  8. <h1>ul要素の例</h1>
  9. <ul>
  10. <li>リストアイテムA</li>
  11. <li>リストアイテムB</li>
  12. </ul>
  13. </body>
  14. </html>

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

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

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

最終確認日

2024-09-01


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>要素を配置している例です。

ブロック
フォーマット
コンテキスト
ブロック
レベル
ボックス

ボックスで表すと、<ul>要素が存在して、その中に <li>要素があります。

<ul>要素は、ブロックレベルブロックコンテナであるボックスを生成します。<ul>要素を含むブロックフォーマットコンテキストがない場合は、新しいブロックフォーマットコンテキストを確立します。<ul>要素は、ブロックレベルのボックスを生成する<li>要素を配置します。なのでここでは、インラインフォーマットコンテキストは確立されません。
尚、この説明は各要素のレンダリングに関する指定が既定値での話で、個々にスタイルを指定した場合はこの限りではありません。


4.コンテンツ属性

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

<ul>要素は、グローバル属性のみ 設定できます。


5.DOM インターフェイス

id属性を用いて
getElementById()メソッドで
要素を取得する方法がお勧めです。

ul要素を表すプロパティはないので、id属性を用いて documentgetElementById()メソッドで、要素を取得する方法がお勧めです。この時に取得できるのはHTMLUListElement オブジェクトです。そのままHTMLElement オブジェクトと同じです。


6.アクセシビリティ

ul要素は、
リスト項目要素を含む
セクションです。

<ul>要素暗黙的なARIAセマンティクスは、role="list" となります。
`list` ロールは、次のようなランドマークを意味します:
リスト項目要素を含むセクションです。リストには、listitemロールを持つ子要素が含まれます。

作成者が<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-start: 1em;
  4. margin-block-end: 1em;
  5. padding-inline-start: 40px;
  6. counter-reset: list-item;
  7. list-style-type: disc;
  8. unicode-bidi: isolate;
  9. }

ul要素は、ブロックレベルのブロックコンテナであるボックスを生成します。

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

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

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

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

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

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

  1. <div style="list-style-type: ">
  2. <p>リスト1</p>
  3. <p>リスト2</p>
  4. <p>リスト3</p>
  5. </div>

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

リスト1

リスト2

リスト3

  1. <ul>
  2. <li><ul>
  3. <li><ul>
  4. <li></li>
  5. <li></li>
  6. </ul></li>
  7. <li><ul>
  8. <li></li>
  9. <li></li>
  10. </ul></li>
  11. </ul></li>
  12. <li><ul>
  13. <li></li>
  14. <li></li>
  15. </ul></li>
  16. </ul>

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

  1. <ul class="culSample262">
  2. <li>リスト1</li>
  3. <li>リスト2</li>
  4. <li>リスト3</li>
  5. </ul>
  1. .culSample262 {
  2. padding-left: 1.5em;
  3. list-style-type: none;
  4. }
  5. .culSample262 > * {
  6. position: relative;
  7. }
  8. .culSample262 > *:before {
  9. position: absolute;
  10. top: 0.4em;
  11. left: -1.0em;
  12. content: "";
  13. width: 10px;
  14. height: 10px;
  15. border-radius: 50%;
  16. background-color: #8b6b4e;
  17. }

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

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

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

  • リスト1
  • リスト2
  • リスト3
  1. <ul class="culSample264">
  2. <li>リスト1</li>
  3. <li>リスト2</li>
  4. <li>リスト3</li>
  5. </ul>
  1. .culSample264 {
  2. padding-left: 1.5em;
  3. list-style-type: none;
  4. }
  5. .culSample264 > * {
  6. position: relative;
  7. }
  8. .culSample264 > *:before {
  9. position: absolute;
  10. top: 0.2em;
  11. left: -1.0em;
  12. content: "";
  13. -webkit-transform: rotate(50deg);
  14. -ms-transform: rotate(50deg);
  15. transform: rotate(50deg);
  16. width: 5px;
  17. height: 10px;
  18. border-right: 3px solid #8b6b4e;
  19. border-bottom: 3px solid #8b6b4e;
  20. }

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

  • リスト1
  • リスト2
  • リスト3
  1. <ul class="culSample265">
  2. <li>リスト1</li>
  3. <li>リスト2</li>
  4. <li>リスト3</li>
  5. </ul>
  1. .culSample265 {
  2. padding-left: 1.5em;
  3. list-style-type: none;
  4. }
  5. .culSample265 > * {
  6. position: relative;
  7. }
  8. .culSample265 > *:before {
  9. position: absolute;
  10. top: 0.2em;
  11. left: -1.2em;
  12. content: "";
  13. width: 15px;
  14. height: 15px;
  15. border-radius: 2px;
  16. border: 1px solid #8b6b4e;
  17. }
  18. .culSample265 > *:after {
  19. position: absolute;
  20. top: 0.35em;
  21. left: -0.9em;
  22. content: "";
  23. -webkit-transform: rotate(50deg);
  24. -ms-transform: rotate(50deg);
  25. transform: rotate(50deg);
  26. width: 3px;
  27. height: 7px;
  28. border-right: 2px solid #8b6b4e;
  29. border-bottom: 2px solid #8b6b4e;
  30. }
  31. .culSample265 > *:hover:before {
  32. background-color: #8b6b4e;
  33. }
  34. .culSample265 > *:hover:after {
  35. border-color: #ffffff;
  36. }

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

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

8.気を付ける点

マーカーの領域

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

マーカーのデザイン

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