homepage Welcome to WebmasterWorld Guest from 54.163.72.86
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

    
Recommended Doctype: any recent changes?
hulahoop




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

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.

 

createErrorMsg




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

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

hulahoop




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

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?

drhowarddrfine




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

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.

encyclo




msg:586138
 5:59 pm on Feb 6, 2006 (gmt 0)

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.

drhowarddrfine




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

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.
hulahoop




msg:586140
 9:57 am on Feb 7, 2006 (gmt 0)

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?

moonbiter




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

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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved