> For AI agents: the complete documentation index is available at /next/zh/llms.txt, the full documentation bundle is available at /next/zh/llms-full.txt.

# `<string>`

APISummary
`<string>` 是用来表示一串字符的数据类型。

## 语法

`<string>` 数据类型是由包含在英文双引号（`"`）或英文单引号（`'`）中的任意数量的 `Unicode` 字符组成。
大多数字符都可以写成字面量的形式，并且所有字符都可以写成以反斜线（`\`）开头的十六进制 `Unicode` 码点的形式。比如说：`\22` 表示一个双引号，`\27` 表示一个单引号，`\A9` 表示版权声明符号（©）。
需要注意的是，在使用某些特殊字符时需要在前面加上反斜线来转义，包括但不限于在双引号字符串中使用双引号字符，在单引号字符串中使用单引号字符，以及反斜线字符，比如 `\\` 表示一个反斜线字符。

## 示例

```css
/* 简单字符串 */
"This string is demarcated by double quotes."
'This string is demarcated by single quotes.'

/* 转义字符 */
"This is a string with \" an escaped double quote."
"This string also has \22 an escaped double quote."
'This is a string with \' an escaped single quote.'
'This string also has \27 an escaped single quote.'
"This is a string with \\ an escaped backslash."
```

## 兼容性

**Compatibility Table**

**Query:** `css.data-type.string`

[Source](https://github.com/lynx-family/lynx-website/tree/main/packages/lynx-compat-data/css/data-type/string.json)

| Feature | Android | HarmonyOS | iOS | macOS | Windows | Web |
| --- | --- | --- | --- | --- | --- | --- |
| string | Yes (1.0) | Yes (3.4) | Yes (1.0) | Yes (1.5) | Yes (1.5) | Yes |

**`string`**

<code>&lt;string&gt;</code>

**Specifications:**
- [https://drafts.csswg.org/css-values/#string](https://drafts.csswg.org/css-values/#string)

