1

I am trying to get a box to appear using the content function

ul li:before {
    color: #009cde;
    content: "\2589";
    padding: 0 2px 0 0;
}

I add the code, but when I hit update the \ gets removed and it adds the numbers in front of my list.

Tim Cooley
  • 749
  • 4
  • 19
  • 38
  • 1
    That's a hex escape. – SLaks Aug 23 '17 at 19:58
  • What does that mean and how do I fix it? – Tim Cooley Aug 23 '17 at 20:01
  • 1
    If you want the content to literally say "\2589" and not output some symbol, then add an extra slash in front of it. The slash is an escape character, meaning it will escape the numbers following it and output the hex symbol associated with the sequence 2589. But you can escape the escape by adding another slash. So your code would be `content: "\\2589"`. [See this question](https://stackoverflow.com/questions/190396/adding-html-entities-using-css-content). – cjl750 Aug 23 '17 at 20:03
  • I want it to display the square. But when I run the program some how the "\" gets dropped and I end up with the numbers, which is not what I want. – Tim Cooley Aug 23 '17 at 20:04
  • Your CSS is correct. Are you saying WordPress (I'm guessing based on your tags on this question) is stripping the backslash out of your CSS? – Jon Uleis Aug 23 '17 at 20:08
  • That is correct. – Tim Cooley Aug 23 '17 at 20:23
  • As a workaround, you can type the character directly... `content: "▉";` – Mr Lister Aug 24 '17 at 07:59

0 Answers0