Skip to content

False positive color-contrast: font-size: 0 elements should be ignored #4820

@straker

Description

@straker

This came up recently where an element with font-size: 0 is throwing a color-contrast violation when the text is not visible. Normally an element with font-size: 0 would have a width and height of 0 (which would be ignored), but explicitly setting the width and height of the element overrides that while still visually hidding the font.

<ol>
  <li>Visible text</li>
  <li style="font-size: 0; width: 16px; height: 16px; background: red; color: #282828;">Not visible</li>
</ol>

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions