Results 1 to 7 of 7

Thread: Surprising importance of DOCTYPE! What happened here?

Hybrid View

  1. #1
    Join Date
    Jun 2004
    Tampa, Florida

    Exclamation Surprising importance of DOCTYPE! What happened here?

    I knew the DOCTYPE tag was there to tell the browser something about the rule sets it should use to process the HTML. But I never realized how much it could muck things up, and I wonder if someone can explain what happened here.

    I was on a few cool sites that lets you generate free navigation menus, some with javascript and some with CSS. One that was done 100% in CSS was on a site called "purecssmenu.com", and I really liked it. So I plugged in some menu data and let it generate some code for me, in a samle HTML file.

    Well I have a pretty dated editor, Homesite 5.5 I think, and I used it to try my new menu, creating a default HTML document, then putting all the CSS style stuff in the <head> tag and the html stuff where I wanted the menu in my page.

    Well it worked fine in Firefox, but in IE 8 or IE 9, the dropdown menus would not work. then i noticed that the sample HTML code created for me by the site had a DOCTYPE like this...

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

    When I put that into my rest page, everything worked perfectly in IE. But now, compare that to the default DOCTYPE generated by my Homesite...

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

    So the only difference is that the one that works actually contains a link to w3c.org. Well like I said, I never paid a huge amount of attention to the DOCTYPE tag, but now that i see the wrong one will break my navigation functionality if I don't get it right, I'm concerned! What if there's some kind of netsplit and a visitor gets to my page, but w3.org can't be reached? And what if I start using HTML 5 for the the new <video> or <audio> tags? Will changing the DOCTYPE to reference HTML 5 start causing problems too?

    I guess I need to understand and pay more attention to this TAG!

  2. #2
    Join Date
    Oct 2013
    Well. Hmmm. The dirty little secret is that no browser ever -- ever -- "called home" to check on the DTD for a DOCTYPE. That's what makes the HTML5 DOCTYPE so much more honest: <!DOCTYPE html>. What's happening is that IE is being IE. It is seeing what it determines is a "malformed" DOCTYPE and went schizoid on you. AKA "Quirks Mode"

  3. #3
    Join Date
    Jun 2004
    Tampa, Florida
    So its safe from here on in to just say <!DOCTYPE html>? I did notice that everything worked fine with that too, I was just afraid someone's older browser might get confused.

    Yeah that was an eye opener to me too! "Call Home"!! That's funny! But I'm surprised! If anything I'd always found IE way more tollerant of "malformed" code then some other browsers I like better. Well live and learn i guess! Thanks! :-)

  4. #4
    Join Date
    Mar 2011
    Well, let's be fair about this. Every major browser defaults to its own "Quirks Mode" unless presented with a complete or qualifying <!DOCTYPE>, not just IE. IE gets the most attention in this area because its (original) Quirks Mode used a non-standard box model, which caused significant layout issues.

    The bottom line is that it's just best practice to use a <!DOCTYPE> that sets browsers to "Standards Compliance Mode" so that they're all at least *trying* to render the page properly according to the W3C standard. If you add a 'reset' stylesheet or create/include your own equivalent, you get very uniform presentation across all browser families.
    Rick Trethewey
    Rainbo Design

  5. #5
    Join Date
    May 2005
    Gold Coast (MS)
    You are missing the URI in the second doctype which is required. Your web editor must be way out dated if that is the doctype generated. A good free editor is CoffeeCup's HTML Editor. You can choose which default doctype you want to use. The w3c.org recommends these doctypes. If in doubt about your HTML/CSS coding, try validating first:

    Why Validate?: http://validator.w3.org/docs/why.html
    CSS Validator: http://jigsaw.w3.org/css-validator/
    HTML Validator: http://validator.w3.org/#validate_by_uri+with_options
    But It Doesn't Validate: http://net.tutsplus.com/articles/gen...esnt-validate/

  6. #6
    Join Date
    Jun 2004
    Tampa, Florida
    I know I tend to overthink backward compatibility. Now certainly for a new site, sure I'll just say <!DOCTYPE html> and be done with it. The glaring worry that comes to mind is this... I have some much older websites that have become pretty popular, and some time ago I started adding my own music compositions, as well as my Videos, by jumping on the FLASH bandwagon. Well now that so many people are browsing on Androids and I-phones, all those features don't work. So I was educating myself about HTML 5, and video and audio conversions, so eventually I could upgrade all my pages that formerly just used FLASH. But if I have to change my <!DOCTYPE> tag to enable HTML5, what will that do to older visitors?

    I know the prevailing wisdom is to just ignore users with browsers 4 or more years old. But I'd rather support back as far as I can. Maybe I have to duplicate these pages, one for HTML 4, and another for HTML5?

  7. #7
    Join Date
    Mar 2011
    HTML 5 is backwards compatible with older browsers insofar as older browsers will be set to Standards Compliance Mode, but they will obviously lack native support for the new HTML elements and more advanced CSS 3 properties. But it's really only versions of IE < 9 that are the issue, and there are add-ons and scripts that will bring support for a good deal of HTML 5 and CSS 3. Chrome, Firefox, and Safari have supported HTML 5 for a few years now so you don't need to worry about them.

    Overall, there's no reason to wait to update your websites to HTML 5.
    Rick Trethewey
    Rainbo Design

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center



X vBulletin 4.2.2 Debug Information

  • Page Generation 0.10964 seconds
  • Memory Usage 3,098KB
  • Queries Executed 13 (?)
More Information
Template Usage (29):
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (7)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)postbit_wrapper
  • (1)showthread_list
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (27):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./includes/functions_threadedmode.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (72):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids_threaded
  • showthread_threaded_construct_link
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates