|  | Posted by Jukka K. Korpela on 02/03/07 22:34 
Scripsit kvnsmnsn@hotmail.com:
 > I'm trying to build a calculator in XHTML, and I've got a button that
 > currently reads "x <- pi", meaning load 3.141592654 into register x.
 > Is there some way to alter the button's label so that in the place of
 > "pi" I have the actual Greek letter pi?
 
 Yes, and you can even have a real arrow character instead of the clumsy
 "<-".
 
 <input type="button" id="compute" value="x ← π">
 
 The above uses character references, with hexadecimal Unicode values. You
 might find the following "mnemonic" alternative more readable as source:
 
 <input type="button" id="compute" value="x ← π">
 
 Browser support tends to be fairly good these days, for relatively common
 characters like the simple arrows and basic Greek letters.
 
 Note, however, that common browser defaults may mean that the font used in
 buttons is a sans-serif font where the letter small pi looks like
 reduced-size capital pi, instead of the shape of small pi that people know
 from math texts. Moreover, its typically in a small font size, smaller than
 copy text! The following would usually help:
 
 <style type="text/css">
 input { font-family: Georgia, Times New Roman, serif; font-size: 100%; }
 </style>
 
 (You may wish to use class attribute on the <input> element and restrict the
 styling to selected <input> elements only, using a class selector in CSS.)
 
 --
 Jukka K. Korpela ("Yucca")
 http://www.cs.tut.fi/~jkorpela/
  Navigation: [Reply to this message] |