Preferred Document Type

C

Call Me Tom

I am currently coding with the following Document Type simply because
it is used in the book I am using to learn HTML.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
blah blah blah
</html>

I've read elsewhere that "you should always use"

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
blah blah blah
</html>

My code validates using the first method and fails using the second.
The failures (so far) have been due to using a trailing / to close
certain tags such as <link blah blah blah />.

Is one method better than the other? Better may be asking too much.
Is one method preferred over the other?

Tom
 
R

richard

I am currently coding with the following Document Type simply because
it is used in the book I am using to learn HTML.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
blah blah blah
</html>

I've read elsewhere that "you should always use"

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
blah blah blah
</html>

My code validates using the first method and fails using the second.
The failures (so far) have been due to using a trailing / to close
certain tags such as <link blah blah blah />.

Is one method better than the other? Better may be asking too much.
Is one method preferred over the other?

Tom


Here's my views on this.
There are two sets of rules. One for the author, one for the browser.
The validator is the only thing that requires the author to make
things work properly. The problem is, the browser may not always
impliment exactly what it is supposed to be as the validator says it
will.

People who write browsers, only look at certain factors. As I don't
think there is a real way for a writer to ensure that all events will
display as the web page author intended. Like he's going to write
50,000 test pages just to make sure it complies with the rules? I
don't think so.

Then they come around every year or so with "NEW" this and that
procedures. Changing tag attributes, adding new tags, deleting old
ones. The problem is, people don't like changing browsers just to keep
up with the advances so old browsers still work with the old system.

The way I see it, if it works the way you want it, and it validates at
least to the point where errors are few and really meaningless, hey,
go for it.

I don't think there is such a thing as a 100% compatible browser.
 
D

dorayme

Call Me Tom said:
I am currently coding with the following Document Type simply because
it is used in the book I am using to learn HTML.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
blah blah blah
</html>

I've read elsewhere that "you should always use"

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
blah blah blah
</html>

My code validates using the first method and fails using the second.
The failures (so far) have been due to using a trailing / to close
certain tags such as <link blah blah blah />.

Is one method better than the other? Better may be asking too much.
Is one method preferred over the other?

Andy Dingley once said:

"HTML 4.01 Strict for the very long-term forseeable future.
_Ten_whole_years_ after HTML 4, we're just about in a state where we
can use it without problems. We're still nowhere near being able to
use XHTML 1.0 as it's meant to be."

Spartanicus said many things, here are some of the best on the subject:

<http://www.spartanicus.utvinternet.ie/no-xhtml.htm>

I say, use 4.01 Strict for the moment and wait till the coast is clear
in the future before changing.
 
R

Roy A.

I am currently coding with the following Document Type simply because
it is used in the book I am using to learn HTML.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 blah blah blah
</html>

IE 6, IE 7 and IE 8 don't understand XHTML. Try that in IE with
an .xhm or .xhtml extension or serve it properly as "application/xhtml
+xml".

If you're using elements from other namespaces like MathML or SVG you
can use "content negotiation" and then use CSS to hide MathML and SVG
elements from legacy browsers. In this way you can make your content
more accessible for people with disabilities or different languages.
 
N

Neredbojias

I am currently coding with the following Document Type simply because
it is used in the book I am using to learn HTML.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
blah blah blah
</html>

I've read elsewhere that "you should always use"

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
blah blah blah
</html>

My code validates using the first method and fails using the second.
The failures (so far) have been due to using a trailing / to close
certain tags such as <link blah blah blah />.

Is one method better than the other? Better may be asking too much.
Is one method preferred over the other?


It's generally considered better to use html 4.01 strict unless you
have a very pressing reason to use xhtml. Furthermore, the "1.x"
versions of xhtml are nothing like the versions that will be if and
when xhtml ever comes to predominance.
 
A

Ari Heino

Call Me Tom kirjoitti seuraavasti:
My code validates using the first method and fails using the second.
The failures (so far) have been due to using a trailing / to close
certain tags such as <link blah blah blah />.

It's quite easy to convert xhtml code to html. Usually the main task is
changing self-closing tags like <link blah blah /> to <link blah blah>
anb said:
Is one method preferred over the other?

As said, use html strict for now. IE family understands it better
(better, not well).
 
J

Jukka K. Korpela

Neredbojias said:
It's generally considered better to use html 4.01 strict unless you
have a very pressing reason to use xhtml.

On the other hand, XHTML as publishing format is mostly just futile
(useless) rather than harmful or risky, provided that you declare it as
text/html in HTTP headers.

So while there is usually no good reason to learn XHTML if you know HTML
4.01 or are just about to learn HTML, it is also true that there is usually
no good reason to un-learn your learning of XHTML or stop using it.
 
R

Roy A.

It's generally considered better to use html 4.01 strict unless you
have a very pressing reason to use xhtml.  

I don't see any pressing reason to use 4.01 strict. Even XHTML 1.0
transitional is rendered in "standards mode" in every browsers. And
the overhead by ignoring the slash in empty elements got to be
marginale. XHTML 1.0 suites me as well as HTML 4.01.

If you want to convert a pdf document to svg and serve it inside you
layout, and then give a link to that document as an alternative to
browsers that don't support xhtml, why not. Well, it might not be
pressing reason, but it would make your work more accesible.
Furthermore, the "1.x"
versions of xhtml are nothing like the versions that will be if and
when xhtml ever comes to predominance.

That sounds more like a FUD than anything else. Are you talking about
xhtml 2.0 or x/html 5? I got a different result:
<http://web.ics.purdue.edu/~ssanty/cgi-bin/eightball.cgi>
 
N

Neredbojias

On the other hand, XHTML as publishing format is mostly just futile
(useless) rather than harmful or risky, provided that you declare it
as text/html in HTTP headers.

So while there is usually no good reason to learn XHTML if you know
HTML 4.01 or are just about to learn HTML, it is also true that there
is usually no good reason to un-learn your learning of XHTML or stop
using it.

I wouldn't use it because, if for no other reason, of the additional
overhead in javascript. Also, the "/>" construct is still technically
incorrect, w3c-valid or not.
 
N

Neredbojias

I don't see any pressing reason to use 4.01 strict. Even XHTML 1.0
transitional is rendered in "standards mode" in every browsers. And
the overhead by ignoring the slash in empty elements got to be
marginale. XHTML 1.0 suites me as well as HTML 4.01.

If you want to convert a pdf document to svg and serve it inside you
layout, and then give a link to that document as an alternative to
browsers that don't support xhtml, why not. Well, it might not be
pressing reason, but it would make your work more accesible.

The "pressing reason" I stated was applied to xhtml. Html is/should be
the default, eschewed only when really necessary.
That sounds more like a FUD than anything else. Are you talking about
xhtml 2.0 or x/html 5?

Both and beyond, with which xhtml will surely not be compatible. Btw,
what's a "fud"?

I got a different result:

Well look at your resource...
 
A

Andy Dingley

I am currently coding with the following Document Type simply because
it is used in the book I am using to learn HTML.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

So burn the book and get a better one. I'd suggest "Head First HTML
with CSS & XHTML", because it's a good book generally and also it
takes a pretty sound line on this question. I'd also be interested to
know which book it is.

That doctype is _WRONG_. It's bad practice in two separate aspects
(XHTML vs HTML & Transitional vs Strict). Now either of these can
easily be justified in some narrow circumstances, but tutorials for
beginners aren't appropriate for either. Justifying both together is
pretty obscure too.

The failures (so far) have been due to using a trailing / to close
certain tags such as <link blah blah blah />.

If you aren't already au fait with XML syntax, and also with the
complexities of XML in a HTML world, then avoid XHTML in favour of
HTML.

XHTML _ought_ to be what we're all happily using by now, but the world
(IE being the main culprit) hasn't got there yet and it's still
premature to act as if it has.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top