Tutorial

How To Add HTML Entities in the CSS Content Property

CSS

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.

Creative Commons License