No empty formatting tags

ZMD009

Inline tags such as <strong> or <em> must contain text; empty tags should be removed or given meaningful content.

✅ Good

<p>This is <strong>really</strong> important.</p>

❌ Bad

<p>This is <strong></strong> important.</p>

When: Inline tags like <strong> or <em> contain no text

Warning: <tag> tag should not be empty

Solution: Provide text content or remove the tag

Why it matters

Accessibility: Empty tags may be skipped or announced as blank by screen readers, disrupting content flow :contentReference[oaicite:5]{index=5}.

SEO: Superfluous markup can dilute keyword signals and add irrelevant nodes to the DOM.

In brief

  • Goal: Eliminate empty inline tags to maintain semantic clarity.
  • What to do: Remove or populate any <strong>, <em>, <span>, or similar inline element that has no text.
  • Why: Empty inline tags add noise and may be rendered or announced incorrectly by assistive technologies.

Intent

Prevent meaningless markup that breaks screen-reader announcements and complicates styling.

Benefits

  • Improved accessibility: screen readers ignore empty elements, but encountering them can disrupt navigation :contentReference[oaicite:3]{index=3}.
  • Cleaner DOM: removing empty nodes reduces document size and simplifies CSS targeting :contentReference[oaicite:4]{index=4}.
  • Better maintainability: developers and automated tools work with fewer irrelevant nodes.

Techniques

  • ARIA practices: Ensure that inline elements conveying emphasis or strong importance wrap non-empty text.
  • HTML validation: Use linters (e.g., eslint-plugin-jsx-a11y) to flag empty inline tags.

HTML Semantics

Inline tags without content serve no semantic purpose and should either be removed or contain descriptive text.

Tips & edge cases

  • Run an HTML validator to catch void inline tags before deployment.
  • Search your codebase for `<strong></strong>` or `<em></em>` and audit each occurrence.