10 Ways To Make Your Site Accessible Using Web Standards

Without argument, one of the most important things to consider when creating a website is that it be accessible to everyone who wants to view it. Does your website play nice with screen readers? Can a user override your style sheet with a more accessible one and still see everything your website has to offer? Would another Web developer be embarrassed if they saw your code? If your website is standards-compliant, you could more confidently answer these questions.

Accessibility

Let’s take a look at 10 ways to improve the accessibility of your XHTML website by making it standards-compliant. We’ll go the extra mile and include criteria that fall beyond the standards set by the W3C but which you should follow to make your website more accessible. Each section lists the criteria you need to meet, explains why you need to meet them and gives examples of what you should and shouldn’t do.

1. Specify The Correct DOCTYPE

Specify the correct DOCTYPE

Criteria.
The Document Type declaration (DOCTYPE) is an instruction that sits at the top of your document. The DOCTYPE is required to tell the browser how to correctly display your page.

Why do I need it?
Without a proper DOCTYPE declaration, the browser tries to automatically assign a DOCTYPE to the page. This can slow down the rendering of your page and cause the page to be displayed inconsistently or incorrectly in different browsers. Consistency is the name of the game when it comes to accessibility.

Okay, so what do I do?
Include a proper DOCTYPE at the top of each page of your website. XHTML 1.1 is recommended, but XHTML 1.0 Strict is an option as well.

  • XHTML 1.1
    This is the cleanest way to code your website. All style for the website is contained in external CSS files. Be sure to add the XML declaration at the top, which is essential because XHTML 1.1 is considered to be true XML.
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

    Note: if you are using XHTML 1.1, you cannot include the XML declaration for visitors who are using Internet Explorer 6. Instead, to support IE6 users, you should conditionally display the XML declaration.

  • XHTML 1.0 Strict
    An alternative to XHTML 1.1. The technical differences between the two are minor, but using XHTML 1.1 is recommended to accommodate future website growth.
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

Two other XHTML 1.0 declarations exist for niche uses. But using either of these DOCTYPEs is discouraged.

  • XHTML 1.0 Transitional
    This is used for pages that need to be viewed on legacy browsers that don’t support CSS. Transitional allows inline styles to be applied to elements.
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  • XHTML 1.0 Frameset
    Use Frameset only on websites that require HTML frames. Of course, static CSS divisions should be used instead of HTML frames, right?
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">

2. Define The Namespace And Default Language

Define the Namespace and Default Language

Criteria.
The XHTML namespace and default language of your page must be included in the <html> element.

Why do I need it?
XHTML websites should define the default namespace. A namespace defines all of the elements you can use within the page. Setting a default language allows a screen reader to tell the visitor which language the page is in without even seeing the content. It is also required by W3C standards.

Okay, so what do I do?
Append the xmlns and lang attributes to the <html> element. In XHTML 1.1, the lang attribute is xml:lang.

  • XHTML 1.1
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  • XHTML 1.0
    <html xmlns="http://www.w3.org/1999/xhtml" lang="en">

3. Supply Proper Meta Tags

Supply proper Meta tags

Criteria.
Supply the http-equiv, language, description and keywords meta tags in the <head> element on your page.

Why do I need it?
The http-equiv meta tag is by far the most important. Used in conjunction with the DOCTYPE, it helps the browser display your page correctly. The language meta tag is important for non-English websites, but it has become common practice to include it on every page, despite the language. The description and keywords meta tags are required more for accessibility than to meet standards because they are commonly used by screen readers.

Okay, so what do I do?
Include these four meta tags in the <head> element on your page.

<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="language" content="en" />
<meta name="description" content="Updating Windows using Microsoft Update" />
<meta name="keywords" content="updating, windows, microsoft, update, techworld" />

Make sure the language you specify in the <html> element is the same one you define in the language meta tag. Also, if you are using XHTML 1.1, make sure the encoding specification in the XML declaration matches the charset in the http-equiv meta tag.

4. Use Accessible Navigation

Use accessible navigation

Criteria.
Allow users to easily identify what page and sub-section of a page they are viewing.

Why do I need it?
A majority of websites today use a combination of text, colors and graphic styles to organize and display information. Many people with disabilities cannot see or use graphics and thus rely on screen readers, custom style sheets and other accessibility tools to retrieve information. Regardless of who visits your website, implementing an accessible navigation system helps them quickly and accurately find the information they are looking for.

Okay, so what do I do?
Create a descriptive title for your website, and then split the page into sub-sections using the heading elements.

  • Include exactly one <title> element within the <head> element:
    <title>Smashing Magazine</title>
  • Include exactly one <h1> element on the page. The <h1> element should match all or part of your <title> element:
    <h1>Smashing Magazine: We smash you with the information that makes your life easier. Really!</h1>
  • All heading tags (<h1>, <h2>, etc.) should have textual content. Alt tags on images do not count.

    Incorrect:

    <h2><img src="logo.png" alt="Smashing Magazine" /></h2>

    Correct:

    <h2><img src="logo.png" alt="Smashing Magazine" />Smashing Magazine</h2>
-->