MDN self-hosted library · e01.org

Test your skills: HTML accessibility

Learnwebdevelopment/Core/Accessibility/CSSandJavaScript

no runnable cells learn-module-assessment upstream source

Learn_web_development/Core/Accessibility/CSS_and_JavaScript

The aim of this skill test is to help you assess whether you've understood our HTML: A good basis for accessibility article.

[!NOTE] To get help, read our Test your skills usage guide. You can also reach out to us using one of our communication channels.

HTML accessibility 1

In this task we will test your understanding of semantic HTML, and why it is good for accessibility. The given text is an information panel with action buttons, but the HTML is really bad.

To complete the task, update the markup to use appropriate semantic HTML. You don't need to worry too much about recreating the exact same look and text sizing, as long as the semantics are good.

```css hidden live-sample___html-ally-1 live-sample___html-ally-2 live-sample___html-ally-3 live-sample___html-ally-4 live-sample___html-ally-2-finish body { background-color: white; color: #333333; font: 1em / 1.4 "Helvetica Neue", "Helvetica", "Arial", sans-serif; padding: 1em; margin: 0; }

  • { box-sizing: border-box; }

<!-- Example-specific code -->

The starting point of the task looks like this:

100%

Here's the underlying code for this starting point:

```html live-sample___html-ally-1
<font size="7">Need help?</font> <br /><br />
If you have any problems with our products, our support center can offer you all
the help you need, whether you want:
<br /><br />
1. Advice choosing a new product
<br />
2. Tech support on an existing product
<br />
3. Refund and cancellation assistance
<br /><br />
<font size="5">Contact us now</font>
<br /><br />
Our help center contains live chat, email addresses, and phone numbers.
<br /><br />
<div class="button">Find Contact Details</div>
<br />
<font size="5">Find out answers</font>
<br /><br />
Our Forums section contains a large knowledge base of searchable previously
asked questions, and you can always ask a new question if you can't find the
answer you're looking for.
<br /><br />
<div class="button">Access Forums</div>

```css live-sample___html-ally-1 .button { color: white; background-color: blue; border-radius: 10px; width: 170px; padding: 10px; text-align: center; }


We've not provided finished content for this task, as it doesn't look significantly different to the starting state.

<details>
<summary>Click here to show the solution</summary>

Your finished HTML should look something like this:

```html
<h2>Need help?</h2>

<p>
  If you have any problems with our products, our support center can offer you
  all the help you need, whether you want:
</p>

<ul>
  <li>Advice choosing a new product</li>
  <li>Tech support on an existing product</li>
  <li>Refund and cancellation assistance</li>
</ul>

<h3>Contact us now</h3>

<p>Our help center contains live chat, email addresses, and phone numbers.</p>

<button>Find Contact Details</button>

<h3>Find out answers</h3>

<p>
  Our Forums section contains a large knowledge base of searchable previously
  asked questions, and you can always ask a new question if you can't find the
  answer you're looking for.
</p>

<button>Access forums</button>

Bonus points for:

  • Just using <button>, not <button class="button"> (repeating semantics is unnecessary), and updating the CSS selector to make sure the button still picks up the styles.
  • Using an unordered list, not an ordered list — the list of items doesn't really need to be in any order.

HTML accessibility 2

In the second task, you have a form containing three input fields.

To complete the task:

  1. Semantically associate the inputs with their labels.
  2. Assume that these inputs will be part of a larger form, and wrap them in an element that associates them all together as a single related group.
  3. Give the group a description/title that summarizes all of the information as personal data.

The starting point of the task looks like this:

100%

Here's the underlying code for this starting point:

```html live-sample___html-ally-2

  • Name
  • Age
  • Email address

```css live-sample___html-ally-2 live-sample___html-ally-2-finish
form {
  width: 400px;
}

li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

The updated form should look like this:

100%

Click here to show the solution Your finished HTML should look something like this: ```html live-sample___html-ally-2-finish
Personal data

</details>

## HTML accessibility 3

In this task you are required to turn all the information links in the paragraph into good, accessible links.

- The first two links just go to regular web pages.
- The third link goes to a PDF, and it's large — 8MB.
- The fourth link goes to a Word document, so the user will need some kind of application installed that can handle that.

To complete the task, update the links appropriately based on the above descriptions.

The starting point of the task looks like this:

100%

Here's the underlying code for this starting point:

```html-nolint live-sample___html-ally-3
<p>
  For more information about our activities, check out our fundraising page
  (<a href="/fundraising" target="_blank">click here</a>), education page
  (<a href="/education" target="_blank">click here</a>), sponsorship pack
  (<a href="/resources/sponsorship.pdf" target="_blank">click here</a>),
   and assessment sheets
  (<a href="/resources/assessments.docx" target="_blank">click here</a>).
</p>
> [!NOTE] > The links in the starting code have the `target="_blank"` attribute set on them, so that when you click on them, they try to open the linked pages in a new tab rather than the same tab. This is not strictly best practice, but we've done it here so that the pages don't open in the MDN Playground output `