// Tutorial //

How To Add HTML Entities in the CSS Content Property

Published on June 21, 2016 · Updated on October 12, 2020
Default avatar
By Alligator.io
Developer and author at DigitalOcean.
How To Add HTML Entities in the CSS Content Property

Introduction

Wondering how to insert special characters and symbols inside generated CSS content? This article will show you how.

Prerequisites

Inserting Special Characters into CSS

Insert special characters and symbols inside generated CSS content using their hex notation instead of the usual HTML entity notation. For example, © becomes \\00a9:

Here’s another example:

.foo::before {
  content: "An ellipsis\2026";
}

Cheatsheet and Conversion Tool

Conclusion

This is how you insert special characters and symbols into CSS.

For a more comprehensive review of the HTML5 markup language, explore our series, How To Build a Website in HTML.


Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in our Questions & Answers section, find tutorials and tools that will help you grow as a developer and scale your project or business, and subscribe to topics of interest.

Sign up
About the authors
Default avatar
Developer and author at DigitalOcean.

Default avatar
Developer and author at DigitalOcean.

Still looking for an answer?

Was this helpful?
Leave a comment

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!