views:

2123

answers:

4

What are escape tags in html?

are they &#34; &#60; &#62; to represent ", <, > And how do these work? Is that hex, or what is it. How is it made, and why aren't they just the characters themselves?

A: 

No, it's not hex, it's decimal. Hex equivalent is &#x3c; But one usually uses &lt; (less-than) for < and &gt; for > instead.

jachymko
A: 

Those escapes are decimal ascii escapes. You can see the values here. Take a look at the HTML column.

Travis Jensen
+3  A: 

Here are some common entities. You do not need to use the full code - there are common aliases for frequently used entities. For example, you can use < and > to indicate less than and greater than symbols. & is ampersand, etc.

EDIT: That should be - &lt; &gt; and &amp;

jthompson
+4  A: 

How do these work?

Anything &#num; is replaced with character from ASCII table matching that number.

Is that hex, or what is it?

It's not hex, the number represents characters number in decimal in ASCII table. Check out ASCII table. Check Dec and HTML columns.

Why aren't they just the characters themselves?

Look at this example:

<div>Hey you can use </div> to end div tag!</div>

It would mess up the interpreter. It's a bad example, but you got the idea.

Why you can't use escape characters like in programming languages?

I don't have exact answer to that. But html same as xml is a markup language and not programming language and answer probably lies within history of how markup languages become what they are now.

Maiku Mori
I think he means, why don't you just use \< to escape <, as in strings in many programming languages?
strager
You're probably right, I misread the first line.
Maiku Mori
NAh, I was just meaning why I couldn't use say < instead of the ascii. But I your example really explains. it. I guess it would confuse the browser.Thanks guys :D