-2

For instance, the below will sometime appear as a square and a letter u, respectively. How can I avoid inconsistencies?

content: "\E07A"; // Shopping cart icon
content: "\1F50E"; // Search icon

By inconsistencies I mean displaying inconsistently on the same machine and same browser. Sometimes it loads correctly, and sometimes it doesn't.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
FlyingPenguin
  • 231
  • 1
  • 9

1 Answers1

0

When you load a font with that glyph in it (through @font-face), it will work consistently. When you don't, you are dependent of the fonts on the machine of the user. In that case you can better replace these 'icons' with SVG images, like this:

content:url('cart.svg');
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Mr. Hugo
  • 11,887
  • 3
  • 42
  • 60
  • Thanks JoostS. It displays inconsistently on the same machine and same browser. I agree replacing it with .svg is a safer bet. Thank you! – FlyingPenguin Oct 19 '21 at 14:19
  • 1
    Then the page is probably (sometimes) not interpreted as UTF-8. But yeah... go for the SVG. It is much safer. – Mr. Hugo Oct 19 '21 at 16:03