1.仕様
OL要素は、
順序付けられている
項目の一覧を
表します。
OL - - (li)* +(%Scriptsupporting) -- ordered list. (Normal elements.) [Flow
- ol
-
順序付き一覧 (ordered list)
- 種類
-
通常要素
- カテゴリ
-
- フロー
コンテンツ - パルパブル
コンテンツ (条件付き)
要素の子に少なくとも1つの li要素が含まれる場合は、パルパブルコンテンツ。
- フロー
- 使用できるコンテキスト
-
フロー
コンテンツ を受け入れる要素フロー
コンテンツ を受け入れる要素のコンテンツとして、使用できます。フロー
コンテンツ を受け入れる要素は、<body>要素 , <section>要素 , <nav>要素 , <aside>要素 , <article>要素 , <header>要素 , <footer>要素 , <main>要素 , <address>要素 , <li>要素 , <dt>要素 , <dd>要素 , <caption>要素 , <th>要素 , <td>要素 , <form>要素 , <fieldset>要素 , <search>要素 , <blockquote>要素 , <figure>要素 , <figcaption>要素 , <div>要素 , <dialog>要素 , <details>要素 です。 - コンテンツモデル
-
0個以上の<li>
要素 オプションでスクリプトをサポートする要素 が混在0個以上の<li>
要素 が配置できます。オプションで、スクリプトをサポートする要素 を混在して配置できます。スクリプトを
サポートする要素 に分類される要素は、<script>要素 , <template>要素 です。 - タグの省略
-
どちらのタグも省略できません。
- コンテンツ属性
-
グローバル属性 他
- reversed
属性 - リストが降順
- start
属性 - マーカーの開始値
- type
属性 - マーカーの種類
- reversed
- DOM インターフェイス
-
HTMLOListElement
[Exposed=Window]
interface HTMLOListElement : HTMLElement {
lastReviewed;
[HTMLConstructor] constructor();
[CEReactions] attribute boolean reversed;
[CEReactions] attribute long start;
[CEReactions] attribute DOMString type;
// also has obsolete members
};
HTMLElement
[Exposed=Window]
interface HTMLElement : Element {
[HTMLConstructor] constructor();
// metadata attributes
[CEReactions] attribute DOMString title;
[CEReactions] attribute DOMString lang;
[CEReactions] attribute boolean translate;
[CEReactions] attribute DOMString dir;
// user interaction
[CEReactions] attribute (boolean or unrestricted double or DOMString)? hidden;
[CEReactions] attribute DOMString inert;
undefined click();
[CEReactions] attribute DOMString accessKey;
readonly attribute DOMString accessKeyLabel;
[CEReactions] attribute boolean draggable;
[CEReactions] attribute boolean spellcheck;
[CEReactions] attribute DOMString writingSuggestions;
[CEReactions] attribute DOMString autocapitalize;
[CEReactions] attribute [LegacyNullToEmptyString] DOMString innerText;
[CEReactions] attribute [LegacyNullToEmptyString] DOMString outerText;
ElementInternals attachInternals();
// The popover API
undefined showPopover();
undefined hidePopover();
boolean togglePopover(optional boolean force);
[CEReactions] attribute DOMString? popover;
};
HTMLElement includes GlobalEventHandlers;
HTMLElement includes ElementContentEditable;
HTMLElement includes HTMLOrSVGElement;
Element
[Exposed=Window]
interface Element : Node {
readonly attribute DOMString? namespaceURI;
readonly attribute DOMString? prefix;
readonly attribute DOMString localName;
readonly attribute DOMString tagName;
[CEReactions] attribute DOMString id;
[CEReactions] attribute DOMString className;
[SameObject, PutForwards=value] readonly attribute DOMTokenList classList;
[CEReactions, Unscopable] attribute DOMString slot;
boolean hasAttributes();
[SameObject] readonly attribute NamedNodeMap attributes;
sequence<DOMString> getAttributeNames();
DOMString? getAttribute(DOMString qualifiedName);
DOMString? getAttributeNS(DOMString? namespace, DOMString localName);
[CEReactions] undefined setAttribute(DOMString qualifiedName, DOMString value);
[CEReactions] undefined setAttributeNS(DOMString? namespace, DOMString qualifiedName, DOMString value);
[CEReactions] undefined removeAttribute(DOMString qualifiedName);
[CEReactions] undefined removeAttributeNS(DOMString? namespace, DOMString localName);
[CEReactions] boolean toggleAttribute(DOMString qualifiedName, optional boolean force);
boolean hasAttribute(DOMString qualifiedName);
boolean hasAttributeNS(DOMString? namespace, DOMString localName);
Attr? getAttributeNode(DOMString qualifiedName);
Attr? getAttributeNodeNS(DOMString? namespace, DOMString localName);
[CEReactions] Attr? setAttributeNode(Attr attr);
[CEReactions] Attr? setAttributeNodeNS(Attr attr);
[CEReactions] Attr removeAttributeNode(Attr attr);
ShadowRoot attachShadow(ShadowRootInit init);
readonly attribute ShadowRoot? shadowRoot;
Element? closest(DOMString selectors);
boolean matches(DOMString selectors);
boolean webkitMatchesSelector(DOMString selectors); // legacy alias of .matches
HTMLCollection getElementsByTagName(DOMString qualifiedName);
HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName);
HTMLCollection getElementsByClassName(DOMString classNames);
[CEReactions] Element? insertAdjacentElement(DOMString where, Element element); // legacy
undefined insertAdjacentText(DOMString where, DOMString data); // legacy
};
GlobalEventHandlers
interface mixin GlobalEventHandlers {
attribute EventHandler onabort;
attribute EventHandler onauxclick;
attribute EventHandler onbeforeinput;
attribute EventHandler onbeforematch;
attribute EventHandler onbeforetoggle;
attribute EventHandler onblur;
attribute EventHandler oncancel;
attribute EventHandler oncanplay;
attribute EventHandler oncanplaythrough;
attribute EventHandler onchange;
attribute EventHandler onclick;
attribute EventHandler onclose;
attribute EventHandler oncontextlost;
attribute EventHandler oncontextmenu;
attribute EventHandler oncontextrestored;
attribute EventHandler oncopy;
attribute EventHandler oncuechange;
attribute EventHandler oncut;
attribute EventHandler ondblclick;
attribute EventHandler ondrag;
attribute EventHandler ondragend;
attribute EventHandler ondragenter;
attribute EventHandler ondragleave;
attribute EventHandler ondragover;
attribute EventHandler ondragstart;
attribute EventHandler ondrop;
attribute EventHandler ondurationchange;
attribute EventHandler onemptied;
attribute EventHandler onended;
attribute OnErrorEventHandler onerror;
attribute EventHandler onfocus;
attribute EventHandler onformdata;
attribute EventHandler oninput;
attribute EventHandler oninvalid;
attribute EventHandler onkeydown;
attribute EventHandler onkeypress;
attribute EventHandler onkeyup;
attribute EventHandler onload;
attribute EventHandler onloadeddata;
attribute EventHandler onloadedmetadata;
attribute EventHandler onloadstart;
attribute EventHandler onmousedown;
[LegacyLenientThis] attribute EventHandler onmouseenter;
[LegacyLenientThis] attribute EventHandler onmouseleave;
attribute EventHandler onmousemove;
attribute EventHandler onmouseout;
attribute EventHandler onmouseover;
attribute EventHandler onmouseup;
attribute EventHandler onpaste;
attribute EventHandler onpause;
attribute EventHandler onplay;
attribute EventHandler onplaying;
attribute EventHandler onprogress;
attribute EventHandler onratechange;
attribute EventHandler onreset;
attribute EventHandler onresize;
attribute EventHandler onscroll;
attribute EventHandler onscrollend;
attribute EventHandler onsecuritypolicyviolation;
attribute EventHandler onseeked;
attribute EventHandler onseeking;
attribute EventHandler onselect;
attribute EventHandler onslotchange;
attribute EventHandler onstalled;
attribute EventHandler onsubmit;
attribute EventHandler onsuspend;
attribute EventHandler ontimeupdate;
attribute EventHandler ontoggle;
attribute EventHandler onvolumechange;
attribute EventHandler onwaiting;
attribute EventHandler onwebkitanimationend;
attribute EventHandler onwebkitanimationiteration;
attribute EventHandler onwebkitanimationstart;
attribute EventHandler onwebkittransitionend;
attribute EventHandler onwheel;
};
ElementContentEditable
interface mixin ElementContentEditable {
[CEReactions] attribute DOMString contentEditable;
[CEReactions] attribute DOMString enterKeyHint;
readonly attribute boolean isContentEditable;
[CEReactions] attribute DOMString inputMode;
};
HTMLOrSVGElement
interface mixin HTMLOrSVGElement {
[SameObject] readonly attribute DOMStringMap dataset;
attribute DOMString nonce; // intentionally no [CEReactions]
[CEReactions] attribute boolean autofocus;
[CEReactions] attribute long tabIndex;
undefined focus(optional FocusOptions options = {});
undefined blur();
};
- ARIA in HTML
-
暗黙的="
list
" ARIAロール="あり" aria-* 属性="GlobalAny
"暗黙的な ARIAセマンティクスは、
role=list
です。作成者が要素に指定してもよい ARIAロール値は、 group, listbox, menu, menubar, none, presentation, radiogroup, tablist, toolbar, tree です。
グローバル aria-* 属性と、許可されたロールに適用される任意の aria-* 属性が記述できます。
- レンダリング
- ブロック
ボックス リスト
ol {
display: block;
margin-block: 1em;
padding-inline-start: 40px;
counter-reset: list-item;
list-style-type: decimal;
unicode-bidi: isolate;
}
:is(dir, dl, menu, ol, ul) ol {
margin-block: 0;
}
ol[type="1"] {
list-style-type: decimal;
}
ol[type=a s] {
list-style-type: lower-alpha;
}
ol[type=A s] {
list-style-type: upper-alpha;
}
ol[type=i s] {
list-style-type: lower-roman;
}
ol[type=I s] {
list-style-type: upper-roman;
}
CSS を大雑把に読むと、 ブロックレベルのブロックコンテナボックス(ブロックボックス)を生成します。 などになります。
- 説明
-
ol
要素 は、順序付けられている項目の一覧を表します。ol
要素 は、項目(アイテム・item)の一覧(リスト・list)を表します。項目が意図的に順序付けられている為、順序を変更すると文書(ドキュメント・document)の意味が変わります。項目の順序に意味がない場合は、ul要素を用います。
リストの項目は、ol要素の li要素の子ノードで、ツリー順になっています。<!DOCTYPE html>
<html lang=
"ja"> <head>
<meta charset=
"utf-8"> <title>
ol要素の例 - (Example of ol element) | 離珠のHTMLでしぃ!</title> <meta name=
"author" content= "コータン (KOUTAN)"> <link rel=
"icon" href= "../favicon.ico" type= "image/vnd.microsoft.icon"> </head>
<body>
<h1>
ol要素の例</h1> <ol>
<li>
1番目のアイテム</li> <li>
2番目のアイテム</li> </ol>
</body>
</html>
このサンプルへのリンクです。
(./exol.htm) - 参照元
-
参照元
- HTML Living Standard. 4.4.5 The ol element (最終更新日 2025年8月29日)
- HTML Living Standard. 15 Rendering 15.3.7 Lists (最終更新日 2025年8月29日)
- HTML 5.3 W3C 初公開ワーキングドラフト. 4.4.6 The ol element (W3Cワーキングドラフト、2017年12月14日)
- HTML 5.3 W3C 初公開ワーキングドラフト. 10. Rendering 10.3.8. Lists (W3Cワーキングドラフト、2017年12月14日)
- HTML 5.2 W3C 勧告. 4.4.6 The ol element (W3C勧告、2017年12月14日)
- HTML 5.2 W3C 勧告. 10.3.8. Lists (W3C勧告、2017年12月14日)
- HTML 5.1 W3C 勧告. 4.4.5 The ol element (W3C勧告、2016年11月1日)
- HTML 5.1 W3C 勧告. 10.3.8. Lists (W3C勧告、2016年11月1日)
- HTML 5 W3C 勧告. 4.4.5 The ol element (W3C勧告、2014年10月28日)
- HTML 5 W3C 勧告. 10.3.8 Lists (W3C勧告、2014年10月28日)
- HTML 4.01 Specification W3C 勧告. 10.2 Unordered lists (UL), ordered lists (OL), and list items (LI) (W3C勧告1999年12月24日)
- HTML 3.2 Reference Specification (W3C勧告1997年1月14日)
- Hypertext Markup Language - 2.0 (November 1995)
- Hypertext Markup Language (HTML) (June 1993)
- <ol>: 順序付きリスト要素 - HTML: ハイパーテキストマークアップ言語 | MDN
- JSONデータ
-
JSON形式での、データのイメージです。
{
"ol": {
"group": "Lists",
"element": "- - (li)* +(%Scriptsupporting) -- ordered list. (Normal elements.) [Flow|Palpablelimited] --",
"attlist": {
"%Global;": "",
"reversed": "(reversed) #IMPLIED -- Number the list backwards --",
"start": "NUMBER #IMPLIED -- Starting value of the list --",
"type": "CDATA #IMPLIED -- Kind of list marker --",
},
"summary": "順序付き一覧 (ordered list)",
"point": "順序付けられている項目の一覧を表します。",
"description": [
"項目(アイテム・item)の一覧(リスト・list)を表します。項目が意図的に順序付けられている為、順序を変更すると文書(ドキュメント・document)の意味が変わります。項目の順序に意味がない場合は、ul要素を用います。",
"リストの項目は、ol要素の li要素の子ノードで、ツリー順になっています。",
],
"elementKind": "Normal",
"categories": [
"Flow",
"Palpablelimited",
],
"categoriessupplement": "要素の子に少なくとも1つの li要素が含まれる場合は、パルパブルコンテンツ。",
"canUsedContexts": "parent (%Flow)*",
"contentModel": "ol (li)* +(%Scriptsupporting)",
"tagOmission": [
"-",
"-",
],
"rendering": [
"Lists",
"Bidirectional",
],
"domInterface": "HTMLOListElement",
"contentAttributes": {
"reversed": "リストが降順",
"start": "マーカーの開始値",
"type": "マーカーの種類",
},
"reference": [
{
"title": "HTML Living Standard. 4.4.5 The ol element. Last Updated 29 August 2025",
"href": "https://html.spec.whatwg.org/multipage/grouping-content.html#the-ol-element",
"heading": "HTML Living Standard. 4.4.5 The ol element",
"sub": "最終更新日 2025年8月29日",
},
{
"title": "HTML Living Standard. 15 Rendering 15.3.7 Lists. Last Updated 29 August 2025",
"href": "https://html.spec.whatwg.org/multipage/rendering.html#lists",
"heading": "HTML Living Standard. 15 Rendering 15.3.7 Lists",
"sub": "最終更新日 2025年8月29日",
},
{
"title": "HTML 5.3 W3C Working Draft. 4.4.6 The ol element. W3C First Public Working Draft, 14 December 2017",
"href": "https://www.w3.org/TR/2017/WD-html53-20171214/grouping-content.html#the-ol-element",
"heading": "HTML 5.3 W3C 初公開ワーキングドラフト. 4.4.6 The ol element",
"sub": "W3Cワーキングドラフト、2017年12月14日",
},
{
"title": "HTML 5.3 W3C Working Draft. 10.3.8. Lists. W3C First Public Working Draft, 14 December 2017",
"href": "https://www.w3.org/TR/2017/WD-html53-20171214/rendering.html#section-lists",
"heading": "HTML 5.3 W3C 初公開ワーキングドラフト. 10. Rendering 10.3.8. Lists",
"sub": "W3Cワーキングドラフト、2017年12月14日",
},
{
"title": "HTML 5.2 W3C Recommendation. 4.4.6 The ol element. W3C Recommendation, 14 December 2017.",
"href": "https://www.w3.org/TR/2017/REC-html52-20171214/grouping-content.html#the-ol-element",
"heading": "HTML 5.2 W3C 勧告. 4.4.6 The ol element",
"sub": "W3C勧告、2017年12月14日",
},
{
"title": "HTML 5.2 W3C Recommendation. 10.3.8. Lists.",
"href": "https://www.w3.org/TR/2017/REC-html52-20171214/rendering.html#section-lists",
"heading": "HTML 5.2 W3C 勧告. 10.3.8. Lists",
"sub": "W3C勧告、2017年12月14日",
},
{
"title": "HTML 5.1 W3C Recommendation. 4.4.5 The ol element. W3C Recommendation, 1 November 2016.",
"href": "https://www.w3.org/TR/2016/REC-html51-20161101/grouping-content.html#the-ol-element",
"heading": "HTML 5.1 W3C 勧告. 4.4.5 The ol element",
"sub": "W3C勧告、2016年11月1日",
},
{
"title": "HTML 5.1 W3C Recommendation. 10.3.8. Lists. W3C Recommendation, 1 November 2016.",
"href": "https://www.w3.org/TR/2016/REC-html51-20161101/rendering.html#section-lists",
"heading": "HTML 5.1 W3C 勧告. 10.3.8. Lists",
"sub": "W3C勧告、2016年11月1日",
},
{
"title": "HTML 5 W3C Recommendation. 4.4.5 The ol element. W3C Recommendation, 28 October 2014.",
"href": "https://www.w3.org/TR/2014/REC-html5-20141028/grouping-content.html#the-ol-element",
"heading": "HTML 5 W3C 勧告. 4.4.5 The ol element",
"sub": "W3C勧告、2014年10月28日",
},
{
"title": "HTML 5 W3C Recommendation. 10.3.8 Lists. W3C Recommendation, 28 October 2014.",
"href": "https://www.w3.org/TR/2014/REC-html5-20141028/rendering.html#lists",
"heading": "HTML 5 W3C 勧告. 10.3.8 Lists",
"sub": "W3C勧告、2014年10月28日",
},
{
"title": "HTML 4.01 Specification W3C Recommendation. 10.2 Unordered lists (UL), ordered lists (OL), and list items (LI). W3C Recommendation 24 December 1999.",
"href": "https://www.w3.org/TR/html401/struct/lists.html#h-10.2",
"heading": "HTML 4.01 Specification W3C 勧告. 10.2 Unordered lists (UL), ordered lists (OL), and list items (LI)",
"sub": "W3C勧告1999年12月24日",
},
{
"title": "HTML 3.2 Reference Specification. W3C Recommendation 14-Jan-1997.",
"href": "https://www.w3.org/TR/2018/SPSD-html32-20180315/",
"heading": "HTML 3.2 Reference Specification",
"sub": "W3C勧告1997年1月14日",
},
{
"title": "Hypertext Markup Language - 2.0. November 1995.",
"href": "https://www.ietf.org/rfc/rfc1866.txt",
"heading": "Hypertext Markup Language - 2.0",
"sub": "November 1995",
},
{
"title": "Hypertext Markup Language (HTML). June 1993.",
"href": "https://www.w3.org/MarkUp/draft-ietf-iiir-html-01.txt",
"heading": "Hypertext Markup Language (HTML)",
"sub": "June 1993",
},
{
"title": "MDN Web Docs. HTML <ol>: The Ordered List element.",
"href": "https://developer.mozilla.org/ja/docs/Web/HTML/Element/ol",
"heading": "<ol>: 順序付きリスト要素 - HTML: ハイパーテキストマークアップ言語 | MDN",
},
],
"version": {
"first": "HTML",
"latest": "HTML Living Standard",
},
"lastReviewed": "2025-08-31",
"obsoleteAttributes": [
"compact",
],
}
}
注意: 簡易に描画する為に、各項目の後ろに
,
を付与しています。JSON の形式では、末尾の項目の後には,
は付けません。 - 最終確認日
-
2025-08-31
2.使用できるコンテキスト
ol要素は、
フローコンテンツを
受け入れる要素に
使用できます。
<ol>
フロー
<body>
<ol>
<li>
項目1</li> <li>
項目2</li> </ol>
</body>
<body>
3.コンテンツモデル
ol要素は、
li要素を
配置できます。
<ol>
スクリプトを
content
<ol>
<li>
<p> 項目1</p></li> <li>
<p> 項目2</p></li> </ol>
<ol>
4.コンテンツ属性
ol要素は、
グローバル属性と、
reversed属性,
start属性,
type属性 を
配置できます。
<ol>
reversed属性
<ol id=
"JOL401"> <li>
リスト1</li> <li>
リスト2</li> <li>
リスト3</li> </ol>
reversed
- リスト1
- リスト2
- リスト3
start属性
<ol start=
"" id="JOL402"> <li>
リスト1</li> <li>
リスト2</li> <li>
リスト3</li> </ol>
start
- リスト1
- リスト2
- リスト3
type属性
<ol type=
"" id="JOL403"> <li>
リスト1</li> <li>
リスト2</li> <li>
リスト3</li> </ol>
type
- リスト1
- リスト2
- リスト3
5.DOM インターフェイス
ol要素を、
直接表す
プロパティは
ありません。
<ol>document
のgetElementById()メソッドを用いてid
他には、document
のquerySelectorAll()メソッドを用いて要素ol
と指定して用いるとか、namedocument
のgetElementsByName()メソッドを用いるとか、状況, 目的によりいろいろあります。
- ol要素の文字の色
- ol要素の文字の色
<form>
この例示の文字の色は、<select onchange=
"document .getElementById( 'JOL501') .style .color = this .value;"> <option value=
"inherit"> 継承する</option> <option value=
"red"> 赤</option> <option value=
"blue"> 青</option> </select>
です。 </form>
<ol id=
"JOL501"> <li>
ol要素の文字の色</li> <li>
ol要素の文字の色</li> </ol>
<ol>
6.アクセシビリティ
ol要素の
暗黙的な
ARIAセマンティクスは
list role
(リスト項目要素を
含むセクション。)
です。
<ol>role
です。list role
は、「リスト項目要素を含むセクション。」です。
リストには、listitem role を持つ子要素が含まれます。
作成者が<ol>group
, listbox
, menu
, menubar
, none
, presentation
, radiogroup
, tablist
, toolbar
, tree
です。
ARIA の状態とプロパティについては、すべての要素で使用できるグローバル
著者は非推奨のdirectory
7.レンダリング
ol {
display: block;
margin-block: 1em;
padding-inline-start: 40px;
counter-reset: list-item;
list-style-type: decimal;
unicode-bidi: isolate;
}
<ol>block
であり、ブロック
ブロック
list-style-type
は、リスト項目要素のマーカーを設定します。decimal
は、数値です。1 から始まります。
unicode-bidi
は、置換されない要素のレンダリングでの Bidirectional text(双方向テキスト) に於いての期待される仕様の様です。
:is(dir, dl, menu, ol, ul) ol { margin-block: 0; }
ol[type='1'] { list-style-type: decimal; }
ol[type=a s] { list-style-type: lower-alpha; }
ol[type=A s] { list-style-type: upper-alpha; }
ol[type=i s] { list-style-type: lower-roman; }
ol[type=I s] { list-style-type: upper-roman; }
<ol>
<body>
<ol>
<li>
ブロックレベルのボックスのみの例。</li> <li>
ブロックレベルのボックスのみの例。</li> </ol>
</body>
<body>
<body>
<ol>
尚、この説明は各要素のレンダリングに関する指定が既定値での話で、個々にスタイルを指定した場合はこの限りではありません。
コンテキスト
フォーマット
コンテキスト
(インライン
<body>
<h1>
インライン</h1> <ol>
<li style=
"display: inline;"> インラインレベルのボックスのみの例。</li> <li style=
"display: inline;"> インラインレベルのボックスのみの例。</li> </ol>
</body>
<body>
<body>
<ol>
尚、この説明は<li>
<ol style=
"list-style-type: ;" id= "JOL701"> <li>
リスト1</li> <li>
リスト2</li> <li>
リスト3</li> </ol>
list-style-type
- リスト1
- リスト2
- リスト3
<div class=
"sdvSample702" id= "JOL702"> <p>
リスト1</p> <p id=
"JPG704"> リスト2</p> <p id=
"JPG705"> リスト3</p> </div>
.sdvSample702 { counter-reset: ndvDemo702 ; }
.sdvSample702 > *:first-child ~ * { counter-increment: ndvDemo702 ; }
.sdvSample702 > *:before { content: counter(ndvDemo702, ) '.'; position: absolute; width: 2.2em; left: -2.5em; text-align: right; }
.sdvSample702 > * { position: relative; margin: 0; }
スタイルシートをstyle
レンダリングの例示なので、<div>
尚、例示で動的に表現する為に、Javascript でスタイルシートを操作していますが、疑似要素の関係で用意したセレクタを選択する方法で動作させています。
リスト1
リスト2
リスト3
<ol class=
"solSample703"> <li>
リスト1</li> <li>
リスト2</li> <li>
リスト3</li> </ol>
.solSample703 { list-style-type: none; }
.solSample703 > * { position: relative; }
.solSample703 > *:before { position: absolute; left: -2.5em; content: counter(list-item); display: table-cell; vertical-align: middle; text-align: center; width: 1.8em; border-radius: 50%; background: #F6A38B; }
マーカーの装飾例です。list-style-typenone
を指定して、改めて疑似要素でマーカーを表しています。
カウンタを list-item そのまま使用した例示です。
- リスト1
- リスト2
- リスト3
<ol class=
"solSample704"> <li>
リスト1</li> <li>
リスト2</li> <li>
リスト3</li> </ol>
.solSample704 { padding: 0 0.5em 0 0; list-style-type: none; }
.solSample704 > * { position: relative; margin-bottom: 5px; padding: 0.5em 0.5em 0.5em 0.5em; line-height: 1.5; vertical-align: middle; border-right: solid 2px #dadada; border-bottom: solid 2px #dadada; border-radius: 15px 0px 0px 15px; color: #505050; background: #dbebf8; }
.solSample704 > *:before { display: inline-block; vertical-align: middle; text-align: center; content: counter(list-item); width: 1em; height: 1em; margin-right: 8px; padding-bottom: 8px; border-radius: 50%; background: #fff; }
.solSample704 > *:hover { background: #9999ff; box-shadow: 0.25em 0.25em 0.25em 0.05em #fcf; }
.solSample704 > *:hover:before { background: #F6A38B; }
そのままコピペで使えるというより、いろいろ盛り込んで提示してアレンジする前提としています。
- リスト1
- リスト2
- リスト3
8.気を付ける点
順序
順序に意味のある項目の一覧を表しているので、単なる番号付けとは違います。<ol>
マーカーの領域
マーカーは一覧に表される項目に付けられます。既定値ではボックスの外に配置されます。マーカーの領域も事前に配慮する必要があります。
項目の一覧
項目の一覧を表しているので、大きなグループなど規模についても考慮が必要かと思います。区分(セクション)などは、順序に意味があってもまとまりが少々大きいかと思います。区分(セクション)の目次などは適切かと思います。
区分(セクション)を開閉式にして一覧できる状態にするという方法もあるので、一概に可否は問えない気を付けるべき事だと思います。