472,958 Members | 2,228 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 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 3386
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: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

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.