Web Development - Written by Shimone Samuel on Friday, February 15, 2008 16:36 - 4 Comments

Accessible footnotes with HTML and CSS

Standing in Dolores Park. Assessing what needs to be packed: a blanket, leash and shoes. San Francisco, CA

Having recently set out on the long journey of mastering a new CMS I’ve found myself searching for and stumbling upon1 all manner of plugins, customizations and tweaks for WordPress.

The latest clever addition I found is the use of footnotes. When used properly, footnotes are an appropriate way of commenting on or referencing a portion of text2.

Footnotes serve as a more graceful way to add an aside compared to the long-winded parenthetical. (For instance, here I could give some personal insight into the guilty pleasure of using lengthy digressions, but as you can see, by the time you reach the end of this amusing passage, the original point is confused with a new idea).

So let’s have a look at the requirements for this project:

  1. A format for referencing footnotes
  2. A format for displaying footnotes
  3. A method of moving between the two
  4. Making your footnotes accessible

A format for referencing footnotes

This first requirement is easy: footnotes are referenced nearly universally with superscript. Deciding what form of superscript to use: number, letter, figure or symbol is entirely up to you. I personally chose numbers.

Fortunately, support for superscript is part of the W3C recommendation for paragraphs, lines and phrases – thereby making it perfectly valid for appropriate use.

In practice, your code may start off looking something like this:

<sup>1</sup>

A format for displaying footnotes

Footnotes are commonly placed at the bottom or “foot” of a page or section. There is no rule stating a footnote cannot go elsewhere, but sticking to traditional conventions is a recommended best practice.

How you choose to style your footnotes is also a personal choice. Perhaps you can peruse your library or book collection to see how it’s been styled elsewhere.

However you choose to style your footnote, using CSS provides the most flexibility to differentiate it from preceding paragraphs.

The resulting code may start off looking something like this:

<div id="footnote">
	<ol>
		<li>Footnote</li>
	</ol>
</div>

By applying an id to the containing div we can cascade the styling of content within. By using an ordered list we retain the continuity of footnotes throughout the page.

A method of moving between the two

Ideally, references should link to their respective footnotes and footnotes should link back to their references. This provides the user with an effortless method of jumping to the footnote and then returning to the passage.

The resulting code may look something like this:

This is some text<sup><a href="#32066" id="fn1">1</a></sup>

<div id="footnote">
	<li id="32066">This is a footnote <a href="#fn1">↑</a></li>
</div>

… and the resulting output may look something like this:

This is some text1

  1. This is a footnote

Making your footnotes accessible

For some, the example above may appear perfectly usable. You see a linked number in superscript, click and you’re taken to a footnote. A link in the footnote returns you to the sentence you last read. It doesn’t take much to deduce this just by looking at it.

For those who aren’t looking however the purpose isn’t as clear. Questions arise for those visiting the page with an assistive device such as JAWS: What is this linked number? Where does the link #32066 take me? Once I get there what will I find and how will I get back? Users of JAWS and other assistive devices are simply not seeing a page with the same clarity.

Once again we check the W3C HTML 4.01 specification for a solution and find a fitting one in section 12.1.4: Link Titles.

The title attribute may be set for both A and LINK to add information about the nature of a link. This information may be spoken by a user agent, rendered as a tool tip, cause a change in cursor image, etc.

The resulting code may look something like this:

This is some text<sup><a href="#32066" id="fn1" title="see footnote">1</a></sup>

<div id="footnote">
	<li id="32066">This is a footnote <a href="#fn1" title="return to article">↑</a></li>
</div>

Add a little CSS and the possibilities are endless!

This is some text1

This is some more text that’s a bit longer than the first2

  1. This is a footnote
  2. This is another footnote with longer text describing some point in greater detail and adding random irrelevance to this passage for the sole purpose of showing text wrapping.

That’s all there is to it. Your methods may vary but this should serve as a good starting point. See below for how we do it here at Like Wow Online.

In a future article we’ll learn how to automate footnote creation with AppleScript. Stay tuned for Part II.. Using AppleScript to create HTML footnotes

  1. To me, Stumble Upon has become nearly as synonymous a verb as Google and I falter when I see or use the term. In this instance I “stumbled” on Justin Blanton’s Footnotes and TextPander article after seeing footnotes used to great effect on the SmartArchives for Wordpress page.
  2. Footnote as defined in the Answers.com dictionary reference: A note placed at the bottom of a page of a book or manuscript that comments on or cites a reference for a designated part of the text.


4 Comments

You can follow any responses to this entry through the RSS 2.0 feed. You can skip to the end and leave a response. Pinging is currently not allowed.

ekspekt
Jun 30, 2009 14:09

interesting post, will come back here, bookmarked your site

Matt Williams
Aug 3, 2009 4:01

I think having all of your “return to article” links saying the same thing might break an accessibility guideline. They all link to different places but say the same thing. How you would name them differently though would be tricky to work out.

Shimone Samuel
Aug 4, 2009 9:55

Thanks for the feedback Matt. I did encounter that question when I created this and realized – what would I call the links? Aside from naming them differently there wouldn’t be a practical way to name their exact destination (e.g. “return to sentence abc”).

I suppose I could name the href or title cleverly but then automating the creation of footnotes with a CMS would be cumbersome.

Looking at the WCAG 2.0 website I see they use a similar convention for their in-page ‘back’ links: “Go to contents” so I guess this remains the most practical method.

In this case, the “return to article link” returns you to the exact place you left off so clicking a footnote and returning should be seamless even if the title isn’t unique.

Thanks!
Shimone

Max Grabowski
Mar 17, 2010 12:30

Great article! The only question that I have is:

What do you do when dealing with multiple superscripts to 1 footnote? I see this on several sites that have legal disclosures. You know, the 3 or 4 spots where you see the same asterisk (*). Going from the astersks to the footnote seems easy, but not the trip back.

I can only think of a Javascript solution, where you would use the onClick event to pass the current superscript id to the “back to content” link’s href value.

Leave a Reply

Comment