πŸ’‘ This page contain affiliate links. By making a purchase through them, we may earn a commission at no extra cost to you.
How to Make Custom Bullet Points With CSS

How to Make Custom Bullet Points With CSS

Ferenc Almasi β€’ 2020 July 31 β€’ Read time 1 min read
  • twitter
  • facebook
CSS

You can easily make custom bullet points for HTML lists with the use of CSS ::before pseudo-element.

Copied to clipboard!
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
bullets.css

Using ::before for Numbering

Another common trick that ::before elements can be used are for numbering headings, for example in a table of contents:

Copied to clipboard! Playground
<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
numbers.html
How to Make Custom Bullet Points With CSS
If you would like to see more Webtips, follow @flowforfrank

Resource

  • twitter
  • facebook
CSS
Did you find this page helpful?
πŸ“š More Webtips
Mentoring

Rocket Launch Your Career

Speed up your learning progress with our mentorship program. Join as a mentee to unlock the full potential of Webtips and get a personalized learning experience by experts to master the following frontend technologies:

Courses

Recommended

This site uses cookies We use cookies to understand visitors and create a better experience for you. By clicking on "Accept", you accept its use. To find out more, please see our privacy policy.