473,386 Members | 1,736 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

HTML standard tags.

When I was first taught html several years ago, I was taught that the
following tags are standard for any html formatted message:
<HTML>
<HEAD>
</HEAD>
</BODY>
</HTML>

In fact, I was taught that the opening tags (not the ones with </) are
mandatory tags.

However, I am stumped by the fact that I can create an html document
without the existence of any of these tags and still view it correctly
in a web browser.

Is this because the html standard (if there is such a thing) has
changed or have web browsers become more forgiving?
Jul 20 '05 #1
6 3409
In post <8d**************************@posting.google.com >
Ludwig77 said...
When I was first taught html several years ago, I was taught that the
following tags are standard for any html formatted message:
<HTML>
<HEAD>
</HEAD>
</BODY>
</HTML>


the opening and closing tags of those elements are optional although
the recommendations do say the head and body of a html document should
be delimited by those tags.


--
brucie a. blackford. 01/August/2003 10:37:08 pm kilo.
http://loser.brucies.com/
Jul 20 '05 #2
In post <17****************@alt-html.org>
brucie said...
<HTML>
<HEAD>
</HEAD>
</BODY>
</HTML>
the opening and closing tags of those elements are optional although
the recommendations do say the head and body of a html document should
be delimited by those tags.

^^^^^^^^^^^^ the html element
--
brucie a. blackford. 01/August/2003 11:02:58 pm kilo.
http://loser.brucies.com/
Jul 20 '05 #3
Ludwig77 wrote:
When I was first taught html several years ago, I was taught that the
following tags are standard for any html formatted message:
<HTML>
<HEAD>
</HEAD>
</BODY>
</HTML>

In fact, I was taught that the opening tags (not the ones with </) are
mandatory tags.
This is incorrect for HTML. The _elements_ are always present, but the
_tags_ don't have to be, at least for HTML. Don't take my word for it
though, feel free to read the specifications yourself. The latest version
of HTML is 4.01:

<URL:http://www.w3.org/TR/html401/>

<URL:http://www.w3.org/TR/html401/struct/global.html#edef-HTML>
<URL:http://www.w3.org/TR/html401/struct/global.html#edef-HEAD>
<URL:http://www.w3.org/TR/html401/struct/global.html#edef-BODY>

What is _not_ optional, however, is the <title> element:

<URL:http://www.w3.org/TR/html401/struct/global.html#edef-TITLE>

HTML 4.01 also requires a doctype declaration:

<URL:http://www.w3.org/TR/html401/struct/global.html#h-7.2>

In practice, most people put them in. There may well be software out there
that isn't very good at understanding HTML, and requires that these tags be
present. XHTML has different rules, so if you are interested in writing
XHTML documents, you'll have to investigate further.

However, I am stumped by the fact that I can create an html document
without the existence of any of these tags and still view it correctly
in a web browser.
Bear in mind that just because something works for you, it doesn't mean that
it will work for your visitors. For instance, if you make the mistake of
serving your HTML files as text/plain, and are able to view it "correctly"
(or, to be more specific, *how you expect*), all that means is people using
Internet Explorer can view it "correctly" (since the browser gets HTTP
wrong), and people using other browsers are shut out.

Is this because the html standard (if there is such a thing) has
changed or have web browsers become more forgiving?


The details above are also correct for HTML 3.2 and HTML 2.0.

Browsers vary in how "forgiving" they are. Some browsers get stricter and
new browsers appear that are stricter, but sometimes the reverse is also
true.

Any sensible author would adhere to the published specifications to avoid
getting caught out when browsers change behaviour in error conditions. You
will never be able to test in all significant user-agents that access a WWW
document. Google is a good example.

For instance, just recently in this newsgroup, somebody was talking about a
document that had been authored seven years ago that used code similar to
the following:

<a href=mailto:us**@example.com>

This fails in Safari - which didn't even exist when the document was first
authored. Fixing the code so that it conformed to the specifications
solved the problem. Will user-agents have the same error handling in the
year 2010 as they do today? I wouldn't bet on it. What about user-agents
in use *today* that you don't know anything about?

More examples can be found here:

<URL:http://www.evolt.org/article/Forward_compatibility_and_web_standards/17/60115/index.html#comment60184>

--
Jim Dabell

Jul 20 '05 #4
Ludwig77 wrote:
When I was first taught html several years ago, I was taught that the
following tags are standard for any html formatted message:
I would hope you meant "document" here. HTML e-mail and news postings are
frowned upon in a lot of contexts.
<HTML>
<HEAD>
</HEAD>
</BODY>
</HTML>
(I assume you meant to include <BODY> in the fourth slot above.)
In fact, I was taught that the opening tags (not the ones with </) are
mandatory tags.

However, I am stumped by the fact that I can create an html document
without the existence of any of these tags and still view it correctly
in a web browser.
It is poor practice to leave these tags out. In HTML 4.01 you can leave them
out and the existence is implied. However, in XHTML 1.0 and later (IIRC)
you can't get away with this.
Is this because the html standard (if there is such a thing) has
changed or have web browsers become more forgiving?


I would call this error recovery even though it is technically allowed.
Never depend on error recovery; it will bite you when you are least
expecting it.

--
Shawn K. Quinn
Jul 20 '05 #5
In post <5c********************@speakeasy.net>
Shawn K. Quinn said...

[omitting optional opening/closing tags]
I would call this error recovery even though it is technically allowed.
Never depend on error recovery; it will bite you when you are least
expecting it.


wouldn't a browser invoking error recovery for something that isn't
broken be itself broken?

--
brucie a. blackford. 02/August/2003 10:56:20 pm kilo.
http://loser.brucies.com/
Jul 20 '05 #6
"Shawn K. Quinn" <sk*****@xevious.kicks-ass.net> wrote in message news:<5c********************@speakeasy.net>...
Ludwig77 wrote:
When I was first taught html several years ago, I was taught that the
following tags are standard for any html formatted message:


I would hope you meant "document" here. HTML e-mail and news postings are
frowned upon in a lot of contexts.
<HTML>
<HEAD>
</HEAD>
</BODY>
</HTML>


(I assume you meant to include <BODY> in the fourth slot above.)
In fact, I was taught that the opening tags (not the ones with </) are
mandatory tags.

However, I am stumped by the fact that I can create an html document
without the existence of any of these tags and still view it correctly
in a web browser.


It is poor practice to leave these tags out. In HTML 4.01 you can leave them
out and the existence is implied. However, in XHTML 1.0 and later (IIRC)
you can't get away with this.
Is this because the html standard (if there is such a thing) has
changed or have web browsers become more forgiving?


I would call this error recovery even though it is technically allowed.
Never depend on error recovery; it will bite you when you are least
expecting it.


Yes, I meant document and yes, I meant <body>.

Thanks,

Greg
Jul 20 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Peter Valdemar M?rch | last post by:
Hi, In short, how to modify selected tags/sections of a HTML file, using PHP as the "modifier"/filter? I would have thought this was a very common usage for PHP... I have a set of existing...
5
by: Donald Firesmith | last post by:
Are html tags allowed within meta tags? Specifically, if I have html tags within a <definition> tag within XML, can I use the definition as the content within the <meta content="description> tag? ...
8
by: Marc Rochkind | last post by:
Nearly everything written about HTML falls into one of two categories: 1. Material written for HTML authors, or 2. Material written for user-agent implementors about standard HTML However,...
4
by: Deepak Mehta | last post by:
I hv to store data with HTML tags in database. user will input data with html tags for e.g.<strong> Name <strong>. And when i will read data in webpage then "Name" should eb bold. but i m getting...
9
by: Jason Gogela | last post by:
Does anyone out there know why I should care whether a <span> is nested in a <p> or vice versa? What is the bennafit of adhering to this standard? It seems to me that regardless of which way you...
4
by: Arthur Dent | last post by:
Hello all, ive been programming with ASP.NET since it came out, but am just getting my feet with now with v.2. Ive noticed something strange in the way my HTML tables get rendered with 2. I use...
9
by: anupamjain | last post by:
Hi, After 2 weeks of search/hit-and-trial I finally thought to revert to the group to find solution to my problem.(something I should have done much earlier) This is the deal : On a JSP...
15
by: lxyone | last post by:
Using a flat file containing table names, fields, values whats the best way of creating html pages? I want control over the html pages ie 1. layout 2. what data to show 3. what controls to...
0
by: Guy Macon | last post by:
Moon wrote: It isn't a question of relative vs. full URL paths in your meta tags. It is a question of following the paths (relative or full URL) in your meta tags vs. not reading the meta tags...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.