2

I run a website that has HTML tutorials on it. I am familiar with the use of ascii character codes like &lt; and &gt; when I am writing HTML tags on my website, but I want to show my users how to write their character codes like this. One of the ones I want to show them is a gap in HTML, represented by &nbsp, but whenever I type it on my HTML document it converts to a space, even though it is in the <code> tags. Is there an alternative that looks the same as &nbsp, but doesn't have any functionality? Maybe with CSS or HTML?

  • 1
    possibly dupicate of http://stackoverflow.com/questions/17427713/how-to-write-out-html-entity-name-nbsp-lt-gt-etc – Insomniac Feb 15 '16 at 07:56

3 Answers3

2

&lt; and the like are not ASCII character codes, they're HTML entities.

And to show them, it's quite simple: escape the & by writing &amp; instead, so write &amp;lt; to show &lt;.

jcaron
  • 17,302
  • 6
  • 32
  • 46
0

I'm also a newbie in html, but try wrapping your code w/ <pre> </pre>

dammy999
  • 11
  • 3
0

I believe if you put it in your markup as

 &amp;nbsp;

It will give you what you want.

Buddy Yaussy
  • 535
  • 2
  • 7