Kyle Meyer says,

Google Maps API—Copyright notice overflowing small map: The right way™

Illustrates the copyright notice overflowing adjacent text

The problem shown is from the copyright notice of a Google Map overflowing the map bounds, and overlapping adjacent information.

I’ve only found a single page that’s provided any information on the problem, and it’s full of bad advice: Change the overflow of the map div to hide the offending portion of the copyright, remove the copyright altogether, or change the size of the font to fit within the map. Unfortunately, all except the last suggestion breaks the Terms of Use, and reducing the font size for a 150px-wide map to make the entire notice fit within would make it entirely illegible.

Fixing this problem The Right Way™ is easy:

#map div {
     max-width: 150px; /* Change to the width of your map */
}
#map div span {
     white-space: normal;
}

This puts the entire copyright notice within the bounds of the map, at the font size that Google specified, and makes it wrap within the frame. Everyone wins.

This post was written by Kyle Meyer on July 2, 2008. Kyle is a front-end web developer in Portland, Oregon. He loves riding his bike, being an avid amateur photographer, and working on side projects when he's not working at Kittelson.

« An Open Letter to Mr. Panic & Mr. MacroMates | My tedious commute to work »

6 Responses to “Google Maps API—Copyright notice overflowing small map: The right way™”

  1. Christian Sauer Says:

    Thanks a lot for your effort, that was exactly the solution I was looking for!

  2. Kyle Meyer Says:

    No sweat. This should really be the default behavior of Google Maps.

    Thanks for letting me know it worked out!

  3. Jose Says:

    Kyle…good job! just a little adjusment i did to make it working always (i dont know why but sometimes when move map -pan- it shows the text), but anyway…your idea using css was really useful.

    my change:

     #map div span {
             display: none;
    	  }
    

    instead of

    #map div {
         max-width: 150px; /* Change to the width of your map */
    }
    #map div span {
         white-space: normal;
    }
    

    works fine too :-)
    Thanks a lot !

  4. Jose Says:

    Sorry, forget to say. My goal was a little different from your: “not to have a text that sometimes appears and sometimes doesnt”, so i’m avoiding it.

  5. Kyle Meyer Says:

    You missed the point.

    The text sometimes appears and sometimes doesn’t because different portions of the map—different aerial photographs—are copyrighted by different people (additional copyright shown) or owned by Google (no text shown).

    Hiding the copyright entirely is against the Terms of Use of using the Google Maps API, and you really shouldn’t do it. I wrote this post because too many people were solving this issue the way you just describe above, which is definitely the wrong way.

  6. John Says:

    Excellent stuff Kyle! It worked perfectly. Thank you!

Comment on this

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word