Welcome to WebmasterWorld Guest from 54.166.222.116

Forum Moderators: incrediBILL

Message Too Old, No Replies

Recommended Doctype: any recent changes?

     
1:39 pm on Feb 6, 2006 (gmt 0)

10+ Year Member



Hello,

I've never put a DocType in my HTML pages (actually they are .asp). I just check validator.w3.org/ and found that I need to do that first.

I have checked out several posting here on this topic but they are quite old. There are so so many different doctypes and need to know which to you.

Here are a few they say that are common but I just can't understand all the mambo jumbo. Can someone help me on which is most common and suitable TODAY. I am using HTML and have asp scripts and my page is save as .asp. Please help.

Here are some of the common ones they mention:
1) HTML 4.01 Strict
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

2) HTML 4.01 Transitional.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

3)HTML 4.01 Frameset.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">

The rest are here:http://www.htmlhelp.com/tools/validator/doctype.html

Also if I use the wrong one, will anything happen or will I be penalized? Please help.

4:26 pm on Feb 6, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Doctypes merely dictate which set of coding standards a given page should be held to. For generally practical purposes, WHICH doctype isn't nearly as important as USING a doctype to begin with. In other words, the most important and upfront differences a doctype makes (the most notable one is that it kicks IE6 into Standards Mode) will be made by any full and valid doctype.

That said, the best doctype, IMO, for someone who doesn't know about them is your #2 above, the HTML4.01 Transitional. This is a little more forgiving than the Strict doctype. I suppose if you use framesets, the Frameset one is best. Somewith with more frameset experience would have to chime in on that one.

Again, the most important things about a doctpye is (a) having one, (b) that it is FULL and VALID, and (c) that it is the very first thing in the source code (not even a whitespace before it).

To ensure that you're using a full and valid doctype, cut and paste it directly from this page [w3.org].

cEM

5:18 pm on Feb 6, 2006 (gmt 0)

10+ Year Member



Thank you CreateMessageError.
Just to confirm, I should use the transitional one right:

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

This should come before the following right?...
<html>
<head>
...
</head>
<body>

Is that it? Thanks.

I did see the example putting this too:
<!ENTITY % HTML.Version "-//W3C//DTD HTML 4.01 Transitional//EN"
-- Typical usage:
Is that needed?

5:30 pm on Feb 6, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



As a differing opinion, I don't feel you want to be 'looser' as you learn html because you may pick up bad habits. Forgiven by the browser you won't understand why it doesn't work, or won't validate, when you switch to strict or xhtml. So learn the details from the beginning and there will be fewer problems later. Use html strict.
5:59 pm on Feb 6, 2006 (gmt 0)

WebmasterWorld Senior Member encyclo is a WebmasterWorld Top Contributor of All Time 10+ Year Member



If you are new to web standards and are using tables-based designs, then it is better to start with the HTML 4.01 Transitional doctype. You add it to the very first line of your page:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html>
<head>
(etc...)

Once your pages validate as HTML 4.01 Transitional, you might want to try HTML 4.01 Strict - this will mean you will need to remve deprecated (outdated) presentational markup and use CSS more extensively.

7:08 pm on Feb 6, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



this will mean you will need to remve deprecated (outdated) presentational markup
Why learn deprecated or outdated markup in the first place? That's my point. Do it right the first time. Just use strict.
9:57 am on Feb 7, 2006 (gmt 0)

10+ Year Member



I am really confuse now. What is strict and what is transitional really? Will I be wrong in using either one? How do I know when to use what?

Honestly my HTML coding with ASP scripts may not really follow convention completely. I try to but I definately may be wrong here and there. What should I do?

11:45 am on Feb 7, 2006 (gmt 0)

10+ Year Member



I am really confuse now. What is strict and what is transitional really? Will I be wrong in using either one? How do I know when to use what?

According to the HTML 4.01 Transitional DTD:

... the HTML 4.01 Transitional DTD, ... includes presentation attributes and elements that W3C expects to phase out as support for style sheets matures. Authors should use the Strict DTD when possible, but may use the Transitional DTD when support for presentation attribute and elements is required.

So, if you need support for deprecated presentational elements [w3.org] and attributes [w3.org] then use the Transitional (also called "Loose") DTD.

 

Featured Threads

Hot Threads This Week

Hot Threads This Month