Failure to meet the contrast requirements can result in poor readability and accessibility barriers.
This issue affects:
This section provides some pass and fail examples of this check.
Text with a dark overlay on a background image
<div style="position: relative; width: 100%; height: 300px; background-image: url('image.jpg'); background-size: cover;">
<div style="position: absolute; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.5);"></div>
<p style="color: #FFFFFF; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 16px;">
High-contrast text
</p>
</div>rgba(0, 0, 0, 0.5) ensures that the white text remains readable.Text with a solid background on top of an image
<div style="background-image: url('image.jpg'); padding: 20px;">
<span style="background-color: #000000; color: #FFFFFF; padding: 5px;">
Clear readable text
</span>
</div>Text over a high-contrast gradient
<p style="color: #FFFFFF; background: linear-gradient(to right, #000000, #333333); padding: 10px;">
Text with sufficient contrast
</p>Text that is placed directly over a background image without an overlay
<div style="background-image: url('image.jpg'); padding: 20px;">
<p style="color: #FFFFFF;">Hard to read text</p>
</div>Low-contrast text over a gradient
<p style="color: #CCCCCC; background: linear-gradient(to right, #FFFFFF, #EEEEEE); padding: 10px;">
Low-contrast text
</p>Text shadow effect without sufficient contrast
<p style="color: #999999; text-shadow: 2px 2px 4px #FFFFFF;">
Blurred text with poor contrast
</p>This section provides information on how to review and fix this issue.
Use contrast detection tools to identify the contrast on each element. Some tools that you can use are:
For more information, visit How to review an accessibility issue.
This section provides instructions on ways to fix this issue.
Use a semi-transparent overlay
.overlay {
background-color: rgba(0, 0, 0, 0.5);
}This helps the text to stand out and leaves the background visible.
Use a high-contrast text color
.text {
color: #FFFFFF;
background-color: #000000;
padding: 5px;
}This ensures readability over any background.
Avoid low-opacity text shadows
Instead of:
text-shadow: 2px 2px 4px #FFFFFF;Use:
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);This maintains contrast and does not blur the text.
If this content did not answer your questions, try searching or contacting our support team for further assistance.
If this content did not answer your questions, try searching or contacting our support team for further assistance.