CSS <string> Data Type

Description

The <string> CSS data type represents character data surrounded with either single (') or double (") quote characters. Any Unicode characters can be included in the string, but many need to be expressed with escape sequences.

Unicode characters may also be entered directly, if the file is saved with the correct encoding and a @charset rule is declared at the top of the stylesheet file.

The CSS escape character is the backslash (\). There are two ways to create an escape sequence:

  • as a backslash followed by the special character (e.g., \" for a double quote or \ for a backslash);
  • as a backslash followed by a hexadecimal number representing the unicode value (e.g., \22 for a double quote, \263A for a smiley face or \a for a line break); either lowercase or uppercase letters may be used for the hexadecimal digits.
For a complete list of Unicode characters, please visit Character Codes website.

Syntax

property: <string>;

Values

  • <string>Defines the characters used in the string.

Example

<div></div>
div::after {
   content: "We all \2665  CSSPortal.com";
}

Browser Support

Desktop
Explorer Edge Chrome Firefox Opera Safari
31211Yes1
Tablets / Mobile
Android Chrome Firefox Opera Safari Samsung
≤37184Yes1Yes

Last updated by CSSPortal on: 9th December 2019