views:

335

answers:

7

How can I display an infinity symbol using html?

+11  A: 

Use the HTML entity ∞ or ∞.

RegDwight
win for simplicity. thanks for all the help!
+5  A: 

From Wikipedia:

∞
brad
+1  A: 

According to this page, it's ∞.

FrustratedWithFormsDesigner
HTML `<font>` is deprecated since 1998 in favour of CSS.
BalusC
A: 

According to List of XML and HTML character entity references:

&#8734;

Next time, try Google. The Google search using your original question gets several useful results: How can I display an infinity symbol using html.

artlung
Google is not a valid answer. If you hadn't also included the right answer, I'd -1 this.
Macha
Google **is** absolutely a valid answer. Google "infinity symbol entity" -- http://www.google.com/search?q=infinity+symbol+entity -- and see the results. The answer is there in the first results. If you feel my answer deserves a downvote, feel free to downvote my answer.
artlung
I go to stackoverflow because when I want to show an infinity symbol, I don't know that I need to search for an "entity".read yehuda katz's "the blind men and the noobs".
http://www.google.com/search?q=How+can+I+display+an+infinity+symbol+using+html gets a good result. I'm glad you learned what a character entity is today.
artlung
"...the mismatch between how we think about problems once we become experienced and the way we feel around like a blind man when getting started makes the experience of getting started...far more painful than it needs to be."
+9  A: 

You can use the following:

  • literal: (if the encoding you use can encode it — UTF-8 can, for example)
  • character reference: &#8734; (decimal), &#x221E; (hexadecimal)
  • entity reference: &infin;

But whether it is displayed correctly does also depend on the font the text is displayed with.

Gumbo
+1 for mentioning the font-dependence. This is often overlooked in case of "unicode characters".
BalusC
+1  A: 

&#8734;

Gregoire
+8  A: 

This does not require a HTML entity if you are using a modern encoding (such as UTF-8). And if you're not already, you probably should be.

Matthew Flaschen
+1 for this. Simple is best.
Mark Byers
Curious: since I don't have a ∞ on my keyboard, would I always have to copy/paste the previous ∞? How do you get it there the first time? I find it easier and faster to type `∞`, but if there's a faster way to get this on to the screen with just a plain ol' keyboard, please share
FrustratedWithFormsDesigner
The “Typing Special Characters” section here might help: http://www.xvsxp.com/misc/keyboard.php
Paul D. Waite
I'm aware of the character maps, but I'm a fast typist and having to toggle to a UI and then back to the editor slows me down. I can still type `∞` faster.
FrustratedWithFormsDesigner
I don't think there's a default key for infinity. However, like anything else you can set up a key shortcut. Jonas Kölker recommended Compose+1/0 (http://stackoverflow.com/questions/311244/keyboard-layout-for-international-programmers/662389#662389)
Matthew Flaschen
What's your environment? On the Mac, it's option-5. In GTK+, it's C-S-u 2 2 1 E. On Windows, it's ALT 2 3 6 (keypad). A good text editor will also have a way to define an abbrev for it.
Ken