Images
Images are used to enhance the user experience of a webpage. They are used to draw the attention of users. Images can save screen space replacing text making it easier to recognize.
NOTE:
- New to accessibility or uncertain of requirements, it will be helpful to review all sections below.
- Already familiar with requirements, skip to the “Working Example” section for sample HTML, CSS and JavaScript (when needed), along with a working demo.
- Images CAN be decorative or informative depending on their purpose on the webpage.
-
The images used on the websites CAN be defined using
<img>
,<svg>
,<canvas>
and so on elements. -
The alt attribute SHOULD be used to denote the purpose of the image defined using
<img>
element. -
The src attribute SHOULD be used to specify the source of the image if defined
using
<img>
element. -
The
role="img"
SHOULD be specified along with descriptivearia-label
to denote the purpose of the image defined using<svg>
element.
Note: Providing role on SVG images along with a descriptivearia-label
attribute makes the image robust across different browser and assistive technology combinations. - All informative images/icons SHOULD meet the color contrast ratio requirement of 3:1 with the background color in different states.
- The text that is displayed within an image SHOULD pass the minimum color contrast ratio requirement of 4.5:1 with the background color.
- Images which do not convey any additional meaning are called decorative images.
- If an image contains information which is already conveyed in the surrounding text, then that image CAN also be considered as decorative.
-
Decorative images SHOULD be hidden for screen reader users by specifying empty alt
attribute i.e.,
alt=""
when image is defined using<img>
element. For example,<img alt="" src="decorative.jpg" height="100" width="100">
-
The decorative images defined using
<svg>
element SHOULD be hidden from assistive technologies using aria-hidden attribute. Additionally, providefocusable="false"
to prevent them from receiving keyboard focus.
For example,<svg aria-hidden="true" focusable="false" width="100" height="100"> (...) </svg>
- Images which convey additional meaning are called informative images.
-
A descriptive textual description for these images MUST be provided.
-
Use
alt
attribute if image is defined using<img>
element -
Use
aria-label
if image is defined using<svg>
element.
-
Use
-
Words such as “image”, “icon”, “graphic” and so on
SHOULD NOT be included within the textual description as the role
“graphic” is already conveyed by screen reader.
For example,<img src="/assets/images/pearson_logo_assessments.png" alt="Pearson Accessibility for Assessments"/>
- Complex images are those images that convey lots of information in a concise manner. For example — Graphs, diagrams, charts and so on.
-
In case of complex images, providing brief textual description using
alt
attribute is not advisable as there is a limit of 150 characters. -
Textual description CAN be provided by any of the following approaches:
- A detailed description CAN be given in the form of text before or after the image on the same page.
- A link CAN be placed before or after the image which directs the user to a page containing a detailed description of the complex image.
- Alternatively, a disclosure widget CAN be used to show/hide the detailed description of the complex image. For more information visit, Disclosure Image Description .
- Images that are used to initiate an action are called functional images.
- These CAN be links or buttons.
-
A descriptive textual description for these images MUST be provided for functional
images.
-
Use
alt
attribute if image is defined using<img>
element -
Use
aria-label
if image is defined using <svg> element.
-
Use
-
Functional images SHOULD be defined using native HTML elements such as
<button>
,<a>
,<input>
and so on.
For example,<a href="https://www.linkedin.com/company/pearson"> <svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 28 28" role="img" aria-label="LinkedIn" focusable="false"> ... </svg> </a>
- Text given within images are NOT readable by the screen reader. Hence, it is NOT advisable to use images of text.
-
If an image of text has been used, the alt text SHOULD be equivalent to the text
present in the image as well.
Note: brand logos, decorative text and text that are part of an image such as graphs, diagrams and so on are exceptions.
- Text given within images is NOT readable by the screen reader. Hence, it is NOT advisable to use images of text.
-
The
alt
text SHOULD be equivalent to the text present in the image as well within the 150-character limit. - Images of text SHOULD be avoided except for logotypes images as they are exceptions.
- Images of text CAN get distorted and pixelated when resized. Hence, it is best to be avoided.
An image which is correctly defined programmatically benefits majorly the below users.
- People with visual disabilities
- People using speech input
<h2>Decorative</h2>
<div class="decorative-image-container" role="presentation">
<img src="./colleagues-laughing-meeting-office.jpg" alt="" class="decorative-image">
<div class="content-tile-text rte-container">
<h3>Our tests</h3>
<p>
Recruiting the best talent gives your business a competitive edge.
Versant tests use advanced AI to evaluate English communication
skills accurately and reliably in real business situations to help
you identify which candidates will be successful in role. Give
employees at all levels the opportunity to thrive in their career
and drive your business forward. Understand their current
proficiency level and pinpoint their development goals.
</p>
</div>
</div>
<h2>Links</h2>
<div class="blog-flex-social-share">
<ul>
<li class="blog-flex-share-fb">
<a href="#" target="_blank" rel="noopener noreferrer">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 147 315" role="img" aria-label="Facebook" focusable="false">
<path class="cls-1" d="M147 55.2H111.4c-7 0-14.1 7.3-14.1 12.7v36.3h49.7c-2 27.8-6.1 53.2-6.1 53.2H97V315H31.8V157.4H0v-53H31.8V61c0-7.9-1.6-61 66.9-61H147V55.2Z"></path>
</svg>
</a>
</li>
<li class="blog-flex-share-twitter">
<a href="#" target="_blank" rel="noopener noreferrer">
<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 28 28" role="img" aria-label="Twitter" focusable="false">
<path d="M24.253 8.756C24.69 17.08 18.297 24.182 9.97 24.62c-3.122.162-6.22-.646-8.86-2.32 2.702.18 5.375-.648 7.507-2.32-2.072-.248-3.818-1.662-4.49-3.64.802.13 1.62.077 2.4-.154-2.482-.466-4.312-2.586-4.412-5.11.688.276 1.426.408 2.168.387-2.135-1.65-2.73-4.62-1.394-6.965C5.574 7.816 9.54 9.84 13.802 10.07c-.842-2.738.694-5.64 3.434-6.48 2.018-.624 4.212.043 5.546 1.682 1.186-.213 2.318-.662 3.33-1.317-.386 1.256-1.248 2.312-2.4 2.942 1.048-.106 2.07-.394 3.02-.85-.458 1.182-1.343 2.15-2.48 2.71z"></path>
</svg>
</a>
</li>
<li class="blog-flex-share-linkedin">
<a href="#" target="_blank" rel="noopener noreferrer">
<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 28 28" role="img" aria-label="LinkedIn" focusable="false">
<path d="M25.424 15.887v8.447h-4.896v-7.882c0-1.98-.71-3.33-2.48-3.33-1.354 0-2.158.91-2.514 1.802-.13.315-.162.753-.162 1.194v8.216h-4.9s.067-13.35 0-14.73h4.9v2.087c-.01.017-.023.033-.033.05h.032v-.05c.65-1.002 1.812-2.435 4.414-2.435 3.222 0 5.638 2.106 5.638 6.632zM5.348 2.5c-1.676 0-2.772 1.093-2.772 2.54 0 1.42 1.066 2.538 2.717 2.546h.032c1.71 0 2.77-1.132 2.77-2.546C8.056 3.593 7.02 2.5 5.344 2.5h.005zm-2.48 21.834h4.896V9.604H2.867v14.73z"></path>
</svg>
</a>
</li>
</ul>
</div>
<h2>Informative</h2>
<img src="./logo--pearson-plus.svg" alt="Pearson+" class="link-image">
.decorative-image {
width: auto;
height: 200px;
margin: 20px;
}
.decorative-image-container {
display: flex;
}
.link-image {
width: 134px;
height: 34px;
}
.blog-flex-social-share {
display: inline-block;
padding: 0;
margin: 0 0 30px;
}
.blog-flex-social-share ul {
display: inline-block;
margin: 0;
padding: 0;
list-style: none;
}
.blog-flex-social-share li {
display: inline-block;
text-align: center;
margin: 0 7px 7px 0;
border-radius: 50%;
width: 42px;
height: 42px;
transition: all .3s;
padding: 0!important;
}
.blog-flex-social-share li a {
display: block;
height: 100%;
padding-top: 10px;
color: #fff;
}
.blog-flex-social-share .share-title {
clip: rect(1px,1px,1px,1px);
clip-path: polygon(0px 0,0px 0,0px 0,0px 0);
position: absolute;
white-space: nowrap;
height: 1px;
width: 1px;
overflow: hidden;
border: 0;
padding: 0;
margin: 0;
max-height: 0;
}
.blog-flex-social-share li a svg { height: 22px; }
.blog-flex-social-share li.blog-flex-share-fb { background-color: #4884d9; }
.blog-flex-social-share li.blog-flex-share-twitter {
background-color: #2ca8d2;
}
.blog-flex-social-share li.blog-flex-share-linkedin {
background-color: #4498c8;
}
.text-image {
display: inline-block;
background-color: #007bff;
color: #fff;
padding: 5px 10px;
font-size: 16px;
border-radius: 5px;
text-decoration: none;
}
@media (max-width: 768px) {
.decorative-image-container {
flex-direction: column;
align-items: flex-end;
}
.decorative-image {
width: 100%;
margin-right: 0;
margin-bottom: 10px;
}
}
h2 {
font-size: 1.5rem;
}
Decorative
Our tests
Recruiting the best talent gives your business a competitive edge. Versant tests use advanced AI to evaluate English communication skills accurately and reliably in real business situations to help you identify which candidates will be successful in role. Give employees at all levels the opportunity to thrive in their career and drive your business forward. Understand their current proficiency level and pinpoint their development goals.