<ul role="list">
<li data-icon="🦄">Unordered list item</li>
<li data-icon="🌈">Cake ice cream sweet sesame snaps dragée cupcake wafer cookie</li>
<li data-icon="😎">Unordered list item</li>
</ul>
<ol role="list">
<li>Ordered list item</li>
<li style="--marker-color: darkcyan">Cake ice cream sweet sesame snaps dragée cupcake wafer cookie</li>
<li style="--marker-color: navy">Ordered list item</li>
</ol>
// Learn more about this technique:
// @link https://moderncss.dev/totally-custom-list-styles/
* {
box-sizing: border-box;
}
/* lists reset */
ol,
ul {
margin: 0 0 0 2em;
padding: 0;
display: grid;
grid-gap: 1.5rem;
}
li {
font-size: 1.5rem;
line-height: 1.25;
padding-left: 0.5em;
}
ul li::marker {
content: attr(data-icon);
font-size: 1.25em;
}
ol {
--marker-color: purple;
li::marker {
content: counter(list-item);
font-family: "Indie Flower";
font-size: 1.5em;
color: var(--marker-color);
}
}
body {
min-height: 100vh;
display: grid;
grid-template-columns: repeat(auto-fit, minmax(30ch, 1fr));
place-items: center;
grid-gap: 2rem;
padding: 1rem;
font-family: "Baloo 2", sans-serif;
color: #3c2948;
background-color: mintcream;
}
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.