Mobile app version of vmapp.org
Login or Join
Hamaas447

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

@Hamaas447

Posted in: #Accessibility #Html #Markup #Seo

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

10.03% popularity Vote Up Vote Down


Login to follow query

More posts by @Hamaas447

3 Comments

Sorted by latest first Latest Oldest Best

 

@Ogunnowo487

This depends on the actual content (there is an important difference between, e.g., a hash and ASCII art) and the context (editable vs. presented content). So after choosing the appropriate element (and possibly WAI-ARIA), HTML5 offers the following options:




The language tag zxx (IETF BCP 47/IANA registry) can be used for "no linguistic content":

<span lang="zxx"><!-- … --></span>

The translate attribute (HTML5) can be used to specify that the content should not be translated:

<span translate="no"><!-- … --></span>

The spellcheck attribute (HTML5) can be used to specify that editable content should not be checked for spelling/grammar errors:

<textarea spellcheck="false"><!-- … --></textarea>

10% popularity Vote Up Vote Down


 

@Eichhorn148

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.

10% popularity Vote Up Vote Down


 

@Gretchen104

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).

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme