# Bad value “yaml” for attribute “lang” on element “code”: Found reserved language tag: “yaml”.

> Canonical HTML version: https://rocketvalidator.com/html-validation/bad-value-yaml-for-attribute-lang-on-element-code-found-reserved-language-tag-yaml
> Attribution: Rocket Validator (https://rocketvalidator.com)
> License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

The language tag `yaml` is reserved by IANA and cannot be used as a value for the `lang` attribute, which expects a valid BCP 47 language tag (like `en` for English or `fr` for French).

The `lang` attribute specifies the **natural language** of an element's content — human languages like English, Spanish, or Japanese. It is not meant to indicate a programming or markup language. When you write `lang="yaml"` on a `<code>` element, the validator rejects it because `yaml` is a reserved IANA subtag with no valid use in BCP 47.

If your goal is to identify the code language for syntax highlighting or styling purposes, use the `class` attribute instead. A common convention, recommended by the HTML specification itself, is to use a class prefixed with `language-`, such as `class="language-yaml"`.

## HTML Examples

### ❌ Invalid: using `lang` for code language

```html
<pre>
  <code lang="yaml">
    name: my-project
    version: 1.0.0
  </code>
</pre>
```

### ✅ Valid: using `class` for code language

```html
<pre>
  <code class="language-yaml">
    name: my-project
    version: 1.0.0
  </code>
</pre>
```

This `class="language-*"` convention is widely supported by syntax highlighting libraries like Prism.js and highlight.js.
