This section provides some pass and fail examples.
High-contrast link with an overlay on an image
<div style="position: relative; width: 100%; height: 300px; background-image: url('background.jpg'); background-size: cover;">
<div style="position: absolute; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.5);"></div>
<a href="#" style="color: #FFFFFF; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 16px; text-decoration: underline;">
Read More
</a>
</div> rgba(0, 0, 0, 0.5) ensures that the white link text is readable.Link with a solid background on top of an image
<div style="background-image: url('background.jpg'); padding: 20px;">
<a href="#" style="background-color: #000000; color: #FFFFFF; padding: 5px; text-decoration: none;">
Learn More
</a>
</div> Sufficient contrast in all link states
a {
color: #0055AA; /* Default state */
}
a:hover, a:focus {
color: #003377; /* Darker color for hover and focus */
}
a:visited {
color: #800080; /* Ensures visited links are still distinguishable */
}Link placed directly on an image with no overlay
<div style="background-image: url('background.jpg'); padding: 20px;">
<a href="#" style="color: #FFFFFF;">Click Here</a>
</div>Low-contrast link on a gradient background
<p style="color: #CCCCCC; background: linear-gradient(to right, #FFFFFF, #EEEEEE); padding: 10px;">
<a href="#" style="color: #AAAAAA;">Learn More</a>
</p>The incorrect use of text shadow gives a low readability score.
<a href="#" style="color: #999999; text-shadow: 2px 2px 4px #FFFFFF;">
More Info
</a>Hover state has low contrast
a {
color: #0055AA; /* Passes contrast */
}
a:hover {
color: #999999; /* Fails contrast */
}This section provides information on how to identify and fix the issue.
The Acquia Web Governance platform highlights elements that contain text with insufficient contrast levels, including standard text on the website as well as link text in various states.
This section provides instructions on how to fix this issue.
Use a semi-transparent overlay
.overlay {
background-color: rgba(0, 0, 0, 0.5);
}This helps links stand out and does not hide the background.
Ensure sufficient contrast in all states
a {
color: #0055AA;
}
a:hover, a:focus {
color: #003377; /* Darker for contrast */
}
a:visited {
color: #800080;
} This prevents links from becoming unreadable when hovered or visited.
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 makes the text readable.
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.