You can easily make custom bullet points for HTML lists with the use of CSS ::before
pseudo-element.
ul {
list-style: none;
}
ul.complete li::before {
content: 'βοΈ ';
}
ul.incomplete li::before {
content: 'β ';
}
// Will produce the following
βοΈ Learn about HTML
βοΈ Learn about CSS
β Learn about JavaScript
Copied to clipboard!
Using ::before for Numbering
Another common trick that ::before
elements can be used are for numbering headings, for example in a table of contents:
<h1>Table of Contents</h1>
<h1>The Tale of CSS</h1>
<h1>Acknowledgments</h1>
<style>
/* Number headings with counters: */
body {
counter-reset: heading;
}
h1:before {
content: counter(heading) β) β;
counter-increment: heading;
}
</style>
<-- Will produce the following: -->
1) Table of Contents
2) The Tale of CSS
3) Acknowledgments
Copied to clipboard!

Resource
Remove adsπ Get access to exclusive content
Want to get access to exclusive content? Support webtips with the price of a coffee to get access to tips, checklists, cheatsheets, and much more. β
Get access