DOCTYPE declarations in FP websites

R

Randy Morgan

While stumbling around looking for good web development practices I came
across several sites talking about a) how important it was to put the
DOCTYPE declaration in web pages and b) how most HTML editors insert an
incorrect or incomplete declaration.

I did some playing around with this, and got unexpected results. I used
a transitional HTML 4.01 declaration, but some things on my page changed
unexpectedly. Two obvious things (there could well be more) are:

1. The entire page is nudged down by several pixels, leaving white space
above the banner.
2. The fill color in the layout cell containing the custom link bar
stops right after the link bar ends.

I saw these problems using IE6, and if it doesn't look right there I'm
almost afraid to see what Firefox or Opera would think of it.

I posted two pages that are identical except for the DOCTYPE declaration
(one has it, one doesn't) at:

http://www.leonardforiowa.com/dev/doctype.htm
http://www.leonardforiowa.com/dev/nodoctype.htm

For the heck of it, I took the doctype page and ran Optimze HTML on it,
selecting everything. It doesn't look to me like it changed anything,
but it's at:

http://www.leonardforiowa.com/dev/doctypeo.htm

In Design View, the doctype page looks fine, meaning that the background
color fills appropriately and there's no whitespace at the top of the
page. Since there's nothing 'broken' in Design View there's nothing for
me to fix, so I'm not sure how to incorporate a DOCTYPE in my pages, but
in browsing around the web in general I see that many commercial website
use them.

I went to this link at MSFT:

http://msdn.microsoft.com/library/d...c_fp2003_ta/html/odc_fpWorkingWithDocType.asp

My summary is that MSFT takes several pages to explain the different
DOCTYPEs and then says that because they use proprietary techniques
FP-generated websites may not validate properly. Fair enough, but this
isn't a validation question, it's a display issue (some might say
they're the same thing, but I would not).

So, what am I missing here? Am I putting the DOCTYPE declaration in the
wrong place (I put it at the very top of the code, before the html tag)?
Am I using the wrong HTML tag (should it be 3.2)? How do I fix or
change whatever is causing the problem if I can't see it in Design View?
Should I even care about DOCTYPE declaration?

Thanks!
 
S

Stefan B Rusynko

That MSDN article has some good links explaining doctypes and their use / selection
Yes the doctype belongs at the top of the page and is used by the browser to determine how to render the page
(not just for validation - which just checks if the Html/CSS code used in your page matches the doctype declaration)

Selecting the correct doctype requires a knowledge of how each browser treats the declaration (or quirks mode when not it is not
present
For an explanation on IE6 use of doctype see
http://msdn.microsoft.com/library/d...cements.asp?frame=true#cssenhancements_topic2

When in doubt, use strict and code only to the strict standards per the W3C (and ignore errors in validation on any FP webbots)




| While stumbling around looking for good web development practices I came
| across several sites talking about a) how important it was to put the
| DOCTYPE declaration in web pages and b) how most HTML editors insert an
| incorrect or incomplete declaration.
|
| I did some playing around with this, and got unexpected results. I used
| a transitional HTML 4.01 declaration, but some things on my page changed
| unexpectedly. Two obvious things (there could well be more) are:
|
| 1. The entire page is nudged down by several pixels, leaving white space
| above the banner.
| 2. The fill color in the layout cell containing the custom link bar
| stops right after the link bar ends.
|
| I saw these problems using IE6, and if it doesn't look right there I'm
| almost afraid to see what Firefox or Opera would think of it.
|
| I posted two pages that are identical except for the DOCTYPE declaration
| (one has it, one doesn't) at:
|
| http://www.leonardforiowa.com/dev/doctype.htm
| http://www.leonardforiowa.com/dev/nodoctype.htm
|
| For the heck of it, I took the doctype page and ran Optimze HTML on it,
| selecting everything. It doesn't look to me like it changed anything,
| but it's at:
|
| http://www.leonardforiowa.com/dev/doctypeo.htm
|
| In Design View, the doctype page looks fine, meaning that the background
| color fills appropriately and there's no whitespace at the top of the
| page. Since there's nothing 'broken' in Design View there's nothing for
| me to fix, so I'm not sure how to incorporate a DOCTYPE in my pages, but
| in browsing around the web in general I see that many commercial website
| use them.
|
| I went to this link at MSFT:
|
| http://msdn.microsoft.com/library/d...c_fp2003_ta/html/odc_fpWorkingWithDocType.asp
|
| My summary is that MSFT takes several pages to explain the different
| DOCTYPEs and then says that because they use proprietary techniques
| FP-generated websites may not validate properly. Fair enough, but this
| isn't a validation question, it's a display issue (some might say
| they're the same thing, but I would not).
|
| So, what am I missing here? Am I putting the DOCTYPE declaration in the
| wrong place (I put it at the very top of the code, before the html tag)?
| Am I using the wrong HTML tag (should it be 3.2)? How do I fix or
| change whatever is causing the problem if I can't see it in Design View?
| Should I even care about DOCTYPE declaration?
|
| Thanks!
|
| --
| Randy Morgan
 
R

Randy Morgan

OK...does this mean I have to go in to code view to make the page
display properly if I use the DOCTYPE? As I mentioned, the page looks
fine in design view but not in preview or live.

Randy Morgan
 
S

Stefan B Rusynko

Yes you add the correct doctype in code view
- but you only view it thru File Preview in Browser




| OK...does this mean I have to go in to code view to make the page
| display properly if I use the DOCTYPE? As I mentioned, the page looks
| fine in design view but not in preview or live.
|
| Randy Morgan
|
| Stefan B Rusynko wrote:
| > That MSDN article has some good links explaining doctypes and their use / selection
| > Yes the doctype belongs at the top of the page and is used by the browser to determine how to render the page
| > (not just for validation - which just checks if the Html/CSS code used in your page matches the doctype declaration)
| >
| > Selecting the correct doctype requires a knowledge of how each browser treats the declaration (or quirks mode when not it is not
| > present
| > For an explanation on IE6 use of doctype see
| >
http://msdn.microsoft.com/library/d...cements.asp?frame=true#cssenhancements_topic2
| >
| > When in doubt, use strict and code only to the strict standards per the W3C (and ignore errors in validation on any FP webbots)
| >
 
R

Randy Morgan

I asked my question poorly...

What I meant was: How do I get the page to load properly after I insert
the DOCTYPE stuff in Code View? I'm using the 4.01 transitional, which
I think it supposed to be more forgiving, but the problems I mentioned
earlier (e.g., white space at top of page, unfilled portion of layout
cell) don't show in Design View, so does that mean FP is generating HTML
that won't display properly when the browser sees the DOCTYPE? If that
is the case, then I have to find and "fix" it in Code View, correct?

Thanks for the help,
Randy Morgan
 
S

Stefan B Rusynko

Preview in Browser
- FP and FP Preview do not use the doctype

As for the specific rendering differences when using transitional read the MSDN link in my post




|I asked my question poorly...
|
| What I meant was: How do I get the page to load properly after I insert
| the DOCTYPE stuff in Code View? I'm using the 4.01 transitional, which
| I think it supposed to be more forgiving, but the problems I mentioned
| earlier (e.g., white space at top of page, unfilled portion of layout
| cell) don't show in Design View, so does that mean FP is generating HTML
| that won't display properly when the browser sees the DOCTYPE? If that
| is the case, then I have to find and "fix" it in Code View, correct?
|
| Thanks for the help,
| Randy Morgan
|
| Stefan B Rusynko wrote:
| > Yes you add the correct doctype in code view
| > - but you only view it thru File Preview in Browser
| >
 

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

Top