124

I have a list where I want to add tick symbol before list text. Is there any CSS that can help me to apply this way?

✓ this is my text
✓ this is my text
✓ this is my text
✓ this is my text
✓ this is my text
✓ this is my text

Note: I want this in this type of HTML code

<ul>
  <li>this is my text</li>
  <li>this is my text</li>
  <li>this is my text</li>
  <li>this is my text</li>
  <li>this is my text</li>
</ul>
Michael Benjamin
  • 346,931
  • 104
  • 581
  • 701
Stack-overflow-hero
  • 1,361
  • 2
  • 9
  • 7

8 Answers8

213

You can use a pseudo-element to insert that character before each list item:

ul {
  list-style: none;
}

ul li:before {
  content: '✓';
}
<ul>
  <li>this is my text</li>
  <li>this is my text</li>
  <li>this is my text</li>
  <li>this is my text</li>
  <li>this is my text</li>
</ul>
Josh Crozier
  • 233,099
  • 56
  • 391
  • 304
  • 1
    I used this and it works in Chrome 65. I was able to wrap each
  • normally using a 1px solid border, float left and margin right on the ul li:before - you can set border color to the background of your element.
  • – ymasood May 01 '18 at 09:59
  • Thanks for the solution! I've added a note that indentation is lost on wrapping. (Apologies for editing the post, but it was better at illustrating the issue than just leaving a comment, and hopefully we can find a way to deal with that.) – Dan Dascalescu Jun 16 '19 at 19:46
  • @Josh: [Adam's answer](https://stackoverflow.com/questions/34141950/how-to-use-tick-checkmark-symbol-instead-of-bullets-in-unordered-list/51208163#51208163) has a solution to the wrapping problem. I've edited it for clarity, up to you to include it. – Dan Dascalescu Jun 16 '19 at 20:03