Click here to Skip to main content
13,146,742 members (79,713 online)
Click here to Skip to main content
Add your own
alternative version

Stats

63.3K views
497 downloads
17 bookmarked
Posted 2 Apr 2007
MIT

See your name in Braille

, 8 Dec 2016
Rate this:
Please Sign up or sign in to vote.
Simple CSS and Javascript to display Braille in web pages (for sighted people)

Introduction

This article offers some CSS and JavaScript to display Braille in your web pages. It can be used to familiarize sighted people with the Braille system. This project is not for real Braille transcription or screen-readers.

In its simplest form (Grade 1) Braille is just a different character set:

Screenshot - BrailleAlphabet

Check out the demo.

Displaying Braille using a CSS sprite.

From the table above, we can easily display a Braille translation of any text by using one image per character. For faster loading, we will use a CSS with class names for all characters and a single picture with sprites of all characters.

The HTML to display "ABC" in Braille can be:

<div class="br br-cap"></div>
<div class="br br-a"></div>
<div class="br br-b"></div>
<div class="br br-c></div>

Using JavaScript to make it easier

We write a simple Javascript function to generate the HTML. There are a few extra rules we should add to our script

  • Uppercases must be prefixed by a special Braille character
  • Numbers are displayed using "a" for "1", "b" for "2"... prefixed with a special character
  • Punctuation signs use more special characters

Now, we can call it to generate longer translations like "Hello World".

document.write(br.braille('Hello World')

For convenience, another function displays the alphabet.

document.write(br.alphabet())

Screenshot - BrailleAlphabet

Otherwise, you may use the library to show your users their name in Braille.

Using the code

It comes in 3 different styles:

Screenshot - braille-big.gif Big

Screenshot - braille-black.gif Small

Screenshot - braille-3d.gif Small-3D

To include the CSS (replace "braille-big.css" by "braille-small.css" or "braille-small-3d.css"):

<link id="css" href="css/braille-big.css" rel="stylesheet">

Note that each CSS needs the image (of the same name) containing a sprite of the Braille alphabet.

To include the Javascript:

<script src="js/braille-tools.js" type="text/javascript" charset="utf-8"></script>

Try this demo live at braille-tools on GitHub.

Another alternative to display Braille in web pages is to use a Braille web fonts.

Eventually, if you really want to learn Braille, I recommend starting with the book Braille for the Sighted from Schneider, and Kathy Kifer. 

License

This article, along with any associated source code and files, is licensed under The MIT License

Share

About the Author

Evoluteur
United States United States
I'm a UI engineer for a startup in California. What I really enjoy is to build tools to describe UI in metadata, store that metadata (outside of the code) in a database, XML or JSON, and then dynamically generate the UI at run-time based on that metadata... which I do with my open source project Evolutility.

My articles on the topic:


My GitHub is Evoluteur.

You may also be interested in...

Pro
Pro

Comments and Discussions

 
GeneralBraille Poland Pin
robert.michal29-Jun-14 5:00
memberrobert.michal29-Jun-14 5:00 
GeneralRe: Braille Poland Pin
Olivier Giulieri8-Jul-14 9:49
memberOlivier Giulieri8-Jul-14 9:49 
QuestionConvert from braille to text using matlab Pin
dinh van phuc21-Jan-13 15:30
memberdinh van phuc21-Jan-13 15:30 
QuestionThank you!! Pin
Member 960893318-Nov-12 2:33
memberMember 960893318-Nov-12 2:33 
AnswerRe: Thank you!! Pin
Olivier Giulieri18-Nov-12 17:18
memberOlivier Giulieri18-Nov-12 17:18 
GeneralFun w/ Braille - Fun w/ Morse Pin
Evoluteur2-Jun-10 22:07
memberEvoluteur2-Jun-10 22:07 
Questionhtml code Pin
Nohamanuna20-Feb-10 19:50
memberNohamanuna20-Feb-10 19:50 
GeneralReversed Braille Pin
Guy Winters26-Jan-08 14:12
memberGuy Winters26-Jan-08 14:12 
GeneralRe: Reversed Braille Pin
Olivier Giulieri27-Jan-08 12:14
memberOlivier Giulieri27-Jan-08 12:14 
GeneralRe: Reversed Braille Pin
Member 1109858521-Sep-14 7:25
memberMember 1109858521-Sep-14 7:25 
QuestionA question on the application's usability Pin
volkan.ozcelik11-Apr-07 21:59
membervolkan.ozcelik11-Apr-07 21:59 
AnswerRe: A question on the application's usability Pin
Olivier Giulieri12-Apr-07 7:23
memberOlivier Giulieri12-Apr-07 7:23 
AnswerRe: A question on the application's usability Pin
Olivier Giulieri12-Apr-07 19:31
memberOlivier Giulieri12-Apr-07 19:31 
GeneralThank you! Pin
araud9-Apr-07 18:43
memberaraud9-Apr-07 18:43 
GeneralRe: Thank you! Pin
Olivier Giulieri9-Apr-07 20:42
memberOlivier Giulieri9-Apr-07 20:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.170915.1 | Last Updated 8 Dec 2016
Article Copyright 2007 by Evoluteur
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid