Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 943781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T22:29:21+00:00 2026-05-15T22:29:21+00:00

Why on the earth there is always a chance that if we use Doctype

  • 0

Why on the earth there is always a chance that if we use “Doctype” with Google Maps, there will be a problem in showing the Google Map correctly?

In a recent case, this “Doctype” just took my 2 days without any productivity. What a disgusting case? This time I got a help from one of my colleague (Subhankar Bannerjee), and many thanks to him due to his timely & efficient help. He also mentioned about this same problem, which he had faced many a times.

Can anyone please tell me why this Doctype problem happens with Google Map?

Any help is greatly appreciated.

EDIT (for comment of @Balus):-
I was using the (X)HTML 1.0 Transitional Doctype, for Mozilla FF & Google Chrome browsers. I haven’t yet checked this Google Map in IE v6+, so I can’t comment on those browsers.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T22:29:21+00:00Added an answer on May 15, 2026 at 10:29 pm

    I had the same problem with Google Maps API v3 a while ago and I must say it wasn’t easy to debug.

    The thing here is that if you don’t use DOCTYPE on your page, the page is rendered in quirks mode. Basically this allows to use styles without any additional CSS or JavaScript. In this case you could use this bit to load the map:

    <body onload="initialize()">
      <div id="map_canvas" style="width:100%; height:100%"></div>
    </body> 
    

    However, with DOCTYPE the page is rendered like the DOCTYPE says so. Setting a style such as above wouldn’t work without any additional CSS as it’s using percentages. The element doesn’t have a size, so you end up taking 100% of nothing. So if you are using XHTML 1.0 Strict, ie.

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml/DTD/xhtml1-strict.dtd">
    

    The page renders as it should if you use pixels instead of percentages:

    <body onload="initialize()">
      <div id="map_canvas" style="width:500px; height:400px"></div>
    </body> 
    

    You could do that also in CSS.

    So your options are here:

    1. Leave the DOCTYPE and use pixels instead of percentages OR specify the width and the height via CSS.

    2. Remove the DOCTYPE and use percentages. This is not recommended as the document should always say what DTD it should be rendered with.

    You can find more info about Quirks mode from here. There’s also a table which shows how different browsers react to the lack of DTD.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is a straight line on google earth or google maps geodesic? That is, when
Common problem: I'm writing a web app with Dojo that has Google Earth front
are there any Flash/Flex API for Google Earth like the Map API? i haven't
I made a web application that is heavily dependent on Google Earth plug-in. There
Is there a KML tag sequence which will position Google Earth to the specified
There is some strange behaviour in parsing KML produced by Google Earth using a
Now that Google Earth has been released for Android 2.1, does anyone know what,
I have a series of maps in a Joomla-based website (there is a map
I have a VB.NET app that generates KML to show within Google Earth. I
There is polygon inside a bigger polygon in Google Earth. Smaller polygon also has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.