By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,960 Members | 2,459 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,960 IT Pros & Developers. It's quick & easy.

What the best choice of DOCTYPE for new pages ?

P: n/a
I need an opinion. I have to add NEW pages to an existing site.

The site has - also - some ASPX pages. These pages, I have seen, have
the following doctype:

<!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" >

These pages are very recent and generated by VS 2005 (most modern tool
for asp.net pages), so I guess Microsoft used that doctype to ensure
some compatibility (?).

For the brand new pages (containing HTML/CSS and Javascript only) I am
going to create, what is the most wise and competent choice for the
DOCTYPE. Should I try to be as strict as possible? And in case why?

-P

Aug 20 '07 #1
Share this Question
Share on Google+
8 Replies


P: n/a
On Mon, 20 Aug 2007, pamela fluente wrote:
<!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" >

These pages are very recent and generated by VS 2005 (most modern tool
for asp.net pages), so I guess Microsoft used that doctype to ensure
some compatibility (?).
Compatible with what?

XHTML is only partially compatible with HTML, and XHTML 1.0 will not be a
subset of later versions of XHTML.
For the brand new pages (containing HTML/CSS and Javascript only) I am
going to create, what is the most wise and competent choice for the
DOCTYPE.
There are long discussions and a long controversy about this topic. I am
not an expert -- so my perception of this controversy is skewed by
ignorance. Here is what a dummy like me believes to have understood:

XHTML is not HTML, only XHTML 1.0 has the same set of tags as HTML 4.0 in a
slightly different syntax. So the answer is: use a doctype XHTML if it is
XHTML and served as such, and use a doctype HTML if it is HTML and served as
such. Serving XHTML as HTML is not recommended (see
http://www.hixie.ch/advocacy/xhtml).

The syntax differences between XHTML 1.0 and HTML 4.0 are small enough that
one can try to comply with both at the same time. (The most important
exception are the "/>" tag delimiters, but it is hardly conceivable that
there will ever be browsers interpreting them the SGML way -- these would
break with most "tag soup" pages, and "tag soup" is de facto the only
feasible way to interpret HTML, given the mess of not standard-compliant Web
pages.)
Should I try to be as strict as possible? And in case why?
More important as strictness is honesty. If your page validates against the
strict DTD, call it strict. If it validates only against the transitional
DTD, call it transitional. If does not even validate against the
transitional DTD, fix it.

Yes, if you have the choice of ensuring that your page validates against the
strict DTD, do it.

--
Helmut Richter
Aug 20 '07 #2

P: n/a
rf
"pamela fluente" <pa***********@libero.itwrote in message
news:11**********************@w3g2000hsg.googlegro ups.com...
>I need an opinion. I have to add NEW pages to an existing site.
HTML 4.01 strict.

--
Richard.
Aug 20 '07 #3

P: n/a
On 20 Ago, 13:13, Helmut Richter <hh...@web.dewrote:
On Mon, 20 Aug 2007, pamela fluente wrote:
<!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" >
These pages are very recent and generated by VS 2005 (most modern tool
for asp.net pages), so I guess Microsoft used that doctype to ensure
some compatibility (?).

Compatible with what?

XHTML is only partially compatible with HTML, and XHTML 1.0 will not be a
subset of later versions of XHTML.
For the brand new pages (containing HTML/CSS and Javascript only) I am
going to create, what is the most wise and competent choice for the
DOCTYPE.

There are long discussions and a long controversy about this topic. I am
not an expert -- so my perception of this controversy is skewed by
ignorance. Here is what a dummy like me believes to have understood:

XHTML is not HTML, only XHTML 1.0 has the same set of tags as HTML 4.0 in a
slightly different syntax. So the answer is: use a doctype XHTML if it is
XHTML and served as such, and use a doctype HTML if it is HTML and served as
such. Serving XHTML as HTML is not recommended (seehttp://www.hixie.ch/advocacy/xhtml).

The syntax differences between XHTML 1.0 and HTML 4.0 are small enough that
one can try to comply with both at the same time. (The most important
exception are the "/>" tag delimiters, but it is hardly conceivable that
there will ever be browsers interpreting them the SGML way -- these would
break with most "tag soup" pages, and "tag soup" is de facto the only
feasible way to interpret HTML, given the mess of not standard-compliant Web
pages.)
Should I try to be as strict as possible? And in case why?

More important as strictness is honesty. If your page validates against the
strict DTD, call it strict. If it validates only against the transitional
DTD, call it transitional. If does not even validate against the
transitional DTD, fix it.

Yes, if you have the choice of ensuring that your page validates against the
strict DTD, do it.

--
Helmut Richter
Thanks, Helmut, for your valuable opinion and pointers. They are very
interesting.

-P

Aug 20 '07 #4

P: n/a
On 20 Ago, 13:24, "rf" <r...@invalid.comwrote:
"pamela fluente" <pamelaflue...@libero.itwrote in message

news:11**********************@w3g2000hsg.googlegro ups.com...
I need an opinion. I have to add NEW pages to an existing site.

HTML 4.01 strict.

--
Richard.
Ok. so I will use this doctype. :-)
When done, what is the most recommandable way to check that my page
fully comply ?

-P

Aug 20 '07 #5

P: n/a
rf

"pamela fluente" <pa***********@libero.itwrote in message
news:11*********************@o80g2000hse.googlegro ups.com...
On 20 Ago, 13:24, "rf" <r...@invalid.comwrote:
>"pamela fluente" <pamelaflue...@libero.itwrote in message

news:11**********************@w3g2000hsg.googlegr oups.com...
>I need an opinion. I have to add NEW pages to an existing site.

HTML 4.01 strict.

--
Richard.

Ok. so I will use this doctype. :-)
When done, what is the most recommandable way to check that my page
fully comply ?
http://validator.w3.org

From there you will also find the CSS validator.

--
Richard.
Aug 20 '07 #6

P: n/a
On 20 Ago, 13:38, "rf" <r...@invalid.comwrote:
"pamela fluente" <pamelaflue...@libero.itwrote in message

news:11*********************@o80g2000hse.googlegro ups.com...
On 20 Ago, 13:24, "rf" <r...@invalid.comwrote:
"pamela fluente" <pamelaflue...@libero.itwrote in message
>news:11**********************@w3g2000hsg.googlegr oups.com...
I need an opinion. I have to add NEW pages to an existing site.
HTML 4.01 strict.
--
Richard.
Ok. so I will use this doctype. :-)
When done, what is the most recommandable way to check that my page
fully comply ?

http://validator.w3.org

From there you will also find the CSS validator.

--
Richard.
Quite busy eh ?!
Anyway, I found another one on the web (WDG)

Line 1112, character 134:
.... png" width="300" height="50" /></div>
^Warning: net-enabling start-tag;
possibly missing required quotes around an attribute value

Line 1114, character 215:
<br /><a style="color:#c0c0c0" href ...
^

It is essentially complaining for the /found in some tag as IMG or
BR
that I used imitating the xhtml generated by VS...

-P
Aug 20 '07 #7

P: n/a
On 20 Aug, 11:29, pamela fluente <pamelaflue...@libero.itwrote:
The site has - also - some ASPX pages. These pages, I have seen, have
the following doctype:
I really don't know what the best doctype is to use here. HTML 4.01
Strict is a good answer (and almost always the best one), bit there
are issues in getting ASP.NET to behave itself if you're not using
XHTML. Apparently these are surmountable, but you'd need to talk to an
ASP.NET expert who also understands what a doctype is. These people
are rare, and most people hereabouts are HTML experts not ASP. You'll
get an answer (HTML 4.01 Strict), but it may not be an easy or
practical one to impose on Visual Studio.

Real advice on how to really do this properly, by someone skilled in
the ASP.NET arts, would be appreciated.

Otherwise XHTML is a nuisance that's best avoided. You can do good
work with it, but it's not useful and it's extra complexity. It's
certainly not a simple "one or the other" choice. It's much discussed
in c.i.w.a.h so search the archives.

If (and only if) your pages are valid Transitional but not valid
Strict (and you can't afford the time to fix that), then it might be
worthwhile to use Transitional instead. If you do this, make sure you
still use a doctype declaration (the thing on your page that
references the doctype itself) that sets your page to "standards-mode
CSS rendering". Read this too:
http://hsivonen.iki.fi/doctype/

Aug 20 '07 #8

P: n/a
rf

"pamela fluente" <pa***********@libero.itwrote in message
news:11**********************@a39g2000hsc.googlegr oups.com...

<snip stuff about validators>
Quite busy eh ?!
?
It is essentially complaining for the /found in some tag as IMG or
BR
that I used imitating the xhtml generated by VS...
You are using XHMTL syntax. Don't. Use HTML.

--
Richard.
Aug 20 '07 #9

This discussion thread is closed

Replies have been disabled for this discussion.