File: syntaxes.md

package info (click to toggle)
node-mdn-data 2.24.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,028 kB
  • sloc: javascript: 98; makefile: 2
file content (44 lines) | stat: -rw-r--r-- 1,386 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Syntaxes

[data](https://github.com/mdn/data/blob/main/css/syntaxes.json) |
[schema](https://github.com/mdn/data/blob/main/css/syntaxes.schema.json)

[CSS value definition syntax](https://developer.mozilla.org/en-US/docs/Web/CSS/Value_definition_syntax) is used for the formal syntax of CSS properties. The syntaxes.json file defines many of these CSS syntaxes.

For example, the `background-attachment` property has the following syntax where `<attachment>` is referring to a syntax that is defined in syntaxes.json.

Definition of `background-attachment` in properties.json:

```json
"background-attachment": {
  "syntax": "<attachment>#"
}
```

Definition of `<attachment>` in syntaxes.json:

```json
"attachment": {
  "syntax": "scroll | fixed | local"
},

```

CSS syntaxes might be more complex than just keywords separated by a pipe (`|`). For example, the syntax might contain values that are referencing
[CSS types](https://github.com/mdn/data/blob/main/css/types.md):

```json
"alpha-value": {
  "syntax": "<number> | <percentage>"
},
```

Or, syntaxes might reference other syntaxes that are also defined in syntaxes.json:

```json
"length-percentage": {
  "syntax": "<length> | <percentage>"
},
```

For more information about the formal grammar of CSS syntaxes, see [CSS value definition syntax](https://developer.mozilla.org/en-US/docs/Web/CSS/Value_definition_syntax).