<div class="container">
<ol data-name="counter()">
<li class="list-item">Ordered list item</li>
<li class="list-item">
Ordered list item
<ol>
<li class="list-item">
Ordered list item
<ol>
<li class="list-item">Ordered list item</li>
<li class="list-item">Ordered list item</li>
<li class="list-item">Ordered list item</li>
</ol>
</li>
<li class="list-item">Ordered list item</li>
<li class="list-item">Ordered list item</li>
<li class="list-item">Ordered list item</li>
</ol>
</li>
<li class="list-item">Ordered list item</li>
<li class="list-item">Ordered list item</li>
</ol>
<ol data-name="counters()">
<li class="list-item">Ordered list item</li>
<li class="list-item">
Ordered list item
<ol>
<li class="list-item">
Ordered list item
<ol>
<li class="list-item">Ordered list item</li>
<li class="list-item">Ordered list item</li>
<li class="list-item">Ordered list item</li>
</ol>
</li>
<li class="list-item">Ordered list item</li>
<li class="list-item">Ordered list item</li>
<li class="list-item">Ordered list item</li>
</ol>
</li>
<li class="list-item">Ordered list item</li>
<li class="list-item">Ordered list item</li>
</ol>
</div>
@import url("https://fonts.googleapis.com/css2?family=Exo:wght@600&display=swap");
* {
box-sizing: border-box;
}
body {
inline-size: 100vw;
min-block-size: 100vh;
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 10px;
font-family: "Exo", Arial, sans-serif;
background-color: #f7f7f7;
line-height: 2;
}
.container {
padding: 10px 20px;
background: #fff;
box-sizing: border-box;
box-shadow: 0 2px 4px rgb(0 0 0 / 20%);
border-radius: 5px;
position: relative;
width: 80%;
min-width: 320px;
display: grid;
grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
gap: 20px;
place-content: center;
place-items: start center;
}
.container ol {
position: relative;
list-style: none;
}
.container > ol::before {
content: attr(data-name);
font-weight: 900;
font-size: 2rem;
margin-bottom: 1.5rem;
display: flex;
justify-content: center;
color: #090f89;
text-shadow: 1px 1px 0 rgb(0 0 0 / 0.5);
}
li::before {
display: inline-flex;
color: #fff;
background-color: #f36;
padding: 10px;
line-height: 1;
font-size: 2rem;
margin-right: 10px;
aspect-ratio: 1 / 1;
justify-content: center;
align-items: center;
clip-path: polygon(
0% 0%,
89% 0,
89% 40%,
100% 50%,
89% 61%,
88% 100%,
0 100%
);
border-radius: 50%;
font-size: 85%;
}
li li::before {
background-color: #09f;
}
li li li::before {
background-color: #89f;
}
ol {
counter-reset: order;
}
li {
counter-increment: order;
}
ol:nth-child(1) li::before {
content: counter(order);
}
ol:nth-child(2) li::before {
content: counters(order, ".");
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.