Skip to content

figcaption-position

Require <figcaption> to be either the first or last child element of <figure>.

Severity

warning

❌ Incorrect

html
<figure>
  <p>Text</p>
  <figcaption>Caption</figcaption>
  <p>More</p>
</figure>

✅ Correct

html
<figure>
  <figcaption>Caption</figcaption>
  <p>Text</p>
</figure>
html
<figure>
  <p>Text</p>
  <figcaption>Caption</figcaption>
</figure>

Reference

Configuration

json
{
  "rules": {
    "figcaption-position": "warning"
  }
}

Released under the MIT License.