Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

Considering the needs of screen readers, browser spell-checking, search engines, etc. how should non-human-language text be marked up in HTML?

Should it be wrapped in a particular tag?
Is there a standard special lang attribute for the enclosing tag (eg. "")?

Note that we may wish to mark up a form input as accepting some sort of non-human-language text.

Examples of non-human-language text:

  • a short cryptographic hash
  • a large block of encrypted data
  • proprietary formal notation
  • ASCII art
share|improve this question
add comment

2 Answers

I like to use the <code> tag for anything code-like, hash-ish (pun), or data blocks. I use the <pre> tag for displaying direct ascii output (such as screen grabs from mainframes or art).

share|improve this answer
    
Definitely agree about <code>, but still curious about how I'd mark up a form input that expected non-language (eg. a textbox for ascii art) to prevent a spell-checker from complaining. Maybe it's not possible? –  Ian Mackinnon Oct 2 '10 at 23:03
    
@Ian Mackinnon - you could use a style sheet to force a monospace font to be used for a textbox and use a code converter to convert any " " into &nbsp; characters to force spaces to translate properly regardless of spacing. –  Joel Etherton Oct 2 '10 at 23:13
add comment

There's no specific recommendations for WCAG 2.0 or even in HTML5 (yet). You can probably wrap it with a <code> tag (like Joel Etherton suggested).

ASCII art is different though. WCAG recommends that you provide the user a text description and a way to skip it. See H86.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.