Nick LaMarca
Nick LaMarca

Reputation: 8188

Add < to Html text to display in a browser

I want to create a tag:

   <div id="Id_Field" class="myclass"> <<Nack>> </div>

So the browser will display:

<<Nack>>

Is this possible?

Upvotes: 0

Views: 61

Answers (4)

justacoder
justacoder

Reputation: 2704

<div id="Id_Field" class="myclass"> &lt;&lt;Nack&gt;&gt; </div>

The above ASCII code will convert to less-than and greater-than symbols when viewing in the browser.

Upvotes: 0

wless1
wless1

Reputation: 3549

use &lt; and &gt; for < and >, respectively

Upvotes: 0

Quentin
Quentin

Reputation: 943214

Use the character reference &gt; to represent a < character as data (as opposed to the start of a tag).

Upvotes: 1

Matt Ball
Matt Ball

Reputation: 359786

Yes. Use the HTML entities: &gt; and &lt;.

http://en.wikipedia.org/wiki/List_of_HTML_entities#Character_entity_references_in_HTML

Upvotes: 2

Related Questions