Re: End tags in HTML



On Apr 9, 8:07 am, Richard Heathfield <r...@xxxxxxxxxxxxxxx> wrote:
gw7...@xxxxxxx said:

I was under the impression that one of the features of HTML was that
you could use pairs of tags, such as <tag> and <\tag>,

You mean </tag>

to mark off a
particular area. I thought this was neat. Indeed, I have written a
program that, when it saves its data, uses just such pairs of tags to
delimit the data and say what it is.

To my total surprise, I found out on Monday that I was wrong. Both XML
and HTML use a forward slash, not a back slash, to indicate an end
tag.

Right.

Has either of these ever used a backslash in an end tag?

I don't think so, no.

Or have I mis-read every single end tag I have ever seen?

It would appear so. :-)

Is there something else
similar that I could possibly have been getting confused with?

Most obvious explanation: the *first* HTML page you saw was written by
someone who got this wrong by using <\foo> to close a tag, and since then
you've blithely assumed that either / or \ is acceptable. This is
plausible only because browsers have always been remarkably adept at
accepting poorly formed HTML.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999

Browsers used to, and still, accept badly formed HTML. If you load an
HTML file with this text in Firefox or MSIE6 ...

<h1>Blah
<p>More blah

.... they will display:

Blah
More blah

However, if you use backslash instead of forward slash in your
tags ...

<h1>Blah<\h1>
<p>More blah<\p>

.... these browsers display the bogus tags as text:

Blah<\h1>
More blah<\p>

So it's unlikely that OP first encountered the bogus closing tags in
HTML files.

It's an intriguing mystery!

--
Kam-Hung Soh <a href="http://kamhungsoh.com/blog";>Software Salariman</
a>
.



Relevant Pages

  • Re: Converting HTML to CSS
    ... LOL We're striking out today Murray. ... I just sent your version to 5 browsers. ... > tags in the header. ...
    (microsoft.public.frontpage.programming)
  • Re: word webpages
    ... The ther are som tags with no closing tags DreamWeaver would remove what ever was causing these problems. ... Just create a simple document and save as HTML Make sure it has some type of formatting. ... XML all versions ...
    (microsoft.public.mac.office.word)
  • Re: Web Pages
    ... The same code just won't work in all browsers. ... a database of all quirks and then somehow analyze the HTML, ... |> are a couple of cases of unclosed, superfluous P tags. ... Usually only empty tags like BR (which has no content to ...
    (microsoft.public.vb.general.discussion)
  • Re: macro and cl-who help
    ... Lisp, but... ... you back into the "walking forms as HTML data" mode, ... This would have been extensible with user-defined tags, ... HTML tags are macros can be functions: ...
    (comp.lang.lisp)
  • Re: Front Page 2000 does NOT allow multiple tags, Whgy not?
    ... DAWG, I'm curious about something. ... my understanding is that the HTML that is served up must have exactly ... tags involved phishing exploits against browsers. ...
    (microsoft.public.frontpage.programming)