Menu
×
   ❮     
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP C C++ C# AWS W3.CSS HOW TO BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS DSA TYPESCRIPT ANGULAR ANGULARJS GIT POSTGRESQL MONGODB ASP AI R GO KOTLIN SWIFT SASS VUE GEN AI SCIPY CYBERSECURITY DATA SCIENCE INTRO TO PROGRAMMING INTRO TO HTML & CSS BASH RUST TOOLS MATH

HTML Tutorial

HTML HOME HTML Introduction HTML Editors HTML Basic HTML Elements HTML Attributes HTML Headings HTML Paragraphs HTML Styles HTML Project I HTML Formatting HTML Quotations HTML Comments HTML Colors HTML CSS HTML Project II HTML Links HTML Images HTML Favicon HTML Page Title HTML Tables HTML Lists HTML Project III HTML Block & Inline HTML Div HTML Classes HTML Id HTML Project IV HTML Buttons HTML Iframes HTML JavaScript HTML File Paths HTML Head HTML Layout HTML Responsive HTML Project V HTML Computercode HTML Semantics HTML Project VI HTML Dialog HTML Style Guide HTML Entities HTML Symbols HTML Emojis HTML Charsets HTML URL Encode HTML vs. XHTML

HTML Forms

HTML Forms HTML Form Attributes HTML Form Elements HTML Input Types HTML Input Attributes Input Form Attributes HTML Project VII

HTML Graphics

HTML Canvas HTML SVG

HTML Media

HTML Media HTML Video HTML Audio HTML YouTube HTML Project VIII

Web Accessibility

Web Accessibility ARIA Attributes Keyboard Focus and tabindex Landmarks Skip Links Color Contrast

Web APIs

Web APIs Geolocation API Drag and Drop API Popover API Web Storage API Web Workers API Server-Sent Events API

HTML Cert

HTML Certificate

HTML Examples

HTML Examples HTML Videos HTML Editor HTML Quiz HTML Exercises HTML Challenges HTML Projects HTML Website HTML Syllabus HTML Study Plan HTML Interview Prep HTML Summary

HTML References

HTML Tag List HTML Attributes HTML Global Attributes HTML Browser Support HTML Event Attributes HTML Colors HTML Canvas HTML Audio/Video HTML Doctypes HTML Character Sets HTML URL Encode HTML Language Codes HTML Country Codes HTTP Status Codes HTTP Request Methods PX to EM Converter Keyboard Shortcuts

Web Accessibility


Share

What is Web Accessibility?

Web accessibility means building pages that everyone can use, including people who:

  • use a screen reader because they are blind or have low vision
  • use only a keyboard instead of a mouse
  • have trouble telling some colors apart
  • need larger text or more contrast

So, always write HTML code with accessibility in mind!

Provide the user a good way to navigate and interact with your site.


Use Semantic HTML

Most web content can be made accessible just by making sure the HTML elements are used for the correct purpose at all times.

Semantic HTML means using the correct HTML elements for their correct purpose as much as possible. So, if you need a button on your web page, use the <button> element, and not a <div> element.

Semantic

<button>Report Error</button>
Try it Yourself »

Non-semantic

<div>Report Error</div>
Try it Yourself »

Semantic HTML gives context to screen readers, which read the contents of a page out loud.

With the button example in mind:

  • buttons have suitable styling by default
  • buttons have built-in keyboard accessibility
  • a screen reader identifies it as a button
  • buttons are focusable and clickable

Use Well-structured Text Content

One of the best accessibility aids a screen reader user can have, is a good text structure with headings, paragraphs, lists, etc.

A good semantic page can look something like the following:

Example

<h1>My Heading</h1>

<p>The first section of text.</p>
<p>Some more text.</p>

<ul>
  <li>A list</li>
  <li>A list</li>
  <li>A list</li>
</ul>

<h2>My subheading</h2>
<p>Some more text.</p>

<h2>My 2nd subheading</h2>
<p>Some more text.</p>
  • A screen reader reads each header out as the user goes through the content, notifying what a heading is, what is a paragraph, etc.
  • A screen reader stops after each element, letting the user go at whatever pace is comfortable
  • Many screen readers allows the user to jump to the next/previous heading
  • Many screen readers can bring up a list of all headings, allowing the user to use it as a table of contents to find specific content

Headings are Important

Headings are defined with the <h1> to <h6> tags:

Example

<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<h4>Heading 4</h4>
<h5>Heading 5</h5>
<h6>Heading 6</h6>
Try it Yourself »

Search engines use the headings to index the structure and content of your web pages. Users skim your pages by its headings. It is important to use headings to show the document structure and the relationships between different sections.

Screen readers also use headings as a navigational tool. <h1> should be used for the main heading, followed by <h2> headings, then the less important <h3>, and so on.

Note: Use HTML headings for headings only. Don't use headings to make text BIG or bold.



Use Clear Language

Always use a clear language, that is easy to understand.

Also try to avoid language and characters that cannot be read out clearly by a screen reader. For example:

  • Avoid dashes. Instead of writing 1-3, write 1 to 3
  • Avoid abbreviations. Instead of writing Feb, write February
  • Avoid slang words

Use Language Code

A language code is a 2-letter abbreviation that specifies the language of a web page. The language code is meant to assist search engines and browsers.

Always include the lang attribute inside the <html> tag, to declare the language of your web page.

The following example specifies that the language of this web page is in English:

<!DOCTYPE html>
<html lang="en">
<body>
...
</body>
</html>

Use Text Alternatives

Always use the alt attribute to provide an alternate text for an image, if the user for some reason cannot view it (because of slow connection, an error in the src attribute, or if the user uses a screen reader).

The value of the alt attribute should always contain a good description of the image:

Example

<img src="img_chania.jpg" alt="A narrow city street with flowers in Chania">
Try it Yourself »

If a browser cannot display the image, it will display the value of the alt attribute:

Example

<img src="wrongname.gif" alt="A narrow city street with flowers in Chania">
Try it Yourself »

Use Good Link Texts

A link text should explain clearly what information the reader will get by clicking on that link.

Examples of good and bad links:


Free account

Track your progress

XP earned 0 Day streak 0 Spaces 0 League —

New

Learn in Adventure Mode W3Schools Adventure App

Coding fundamentals as bite-sized lessons and challenges.

×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
sales@w3schools.com

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
help@w3schools.com

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookies and privacy policy.

Copyright 1999-2026 by W3Schools. All Rights Reserved. W3Schools is Powered by W3.CSS.