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 6918737
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:53:52+00:00 2026-05-27T09:53:52+00:00

I am using a google maps api v3 to load some data from a

  • 0

I am using a google maps api v3 to load some data from a kml file. I wish to style the description data when it is shown in an info window to suit my web page.

Now I am trying to set the style:

style="margin-left:-20px;border:2px dotted #897823; et-a;" 

…inside the description tag of a Kml Placemark but it is not rendering it properly.

I can see that firebug just shows up the positives values of margin and padding. It entirely ignores the negative margin values. So, I was wondering, are any limitation in using css style attributes for kml files?

<placemark>
 <name><![CDATA[First Office Address]]></name>
    <description>
      <![CDATA[
        First Line Information<br> 
        California addresss<br>
        Peak valley<br> 
        <div class="cInfo">Telephone<br>
        Office 9089YUHJT General: (2457TYGFR</div>
      ]]>
    </description>
    <Point>
      <coordinates>-420.2300,137.5332200,0</coordinates>    
    </Point>
</placemark>
  • 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-27T09:53:53+00:00Added an answer on May 27, 2026 at 9:53 am

    The issue you are having is due to Content scrubbing in the Api. Scrubbing the contents is a security measure to prevent malicious code from executing.

    When a feature balloon’s description contents are scrubbed, the following code is removed:

    • JavaScript
    • CSS
    • <iframe> tags
    • <embed> tags
    • <object> tags

    If you take a look at the markup in a debugger you will see that you are actually getting something like the following:

    <div style="font-family: Arial,sans-serif; font-size: small;">
        <div id="iw_kml">
          First Line Information<br> 
          California addresss<br>
          Peak valley<br> 
          <div>Telephone<br>Office 9089YUHJT General: (2457TYGFR</div> 
        </div>
    </div>
    

    You don’t say how you are opening the info windows, but something like the following should work for you. Basically you suppress the default info window and then build your own custom one.

    function initialize() {
        var myLatlng = new google.maps.LatLng(0, 0);
        var myOptions = {
            zoom: 12,
            center: myLatlng,
            mapTypeId: google.maps.MapTypeId.ROADMAP
        };
    
        var map = new google.maps.Map(
            document.getElementById("map_canvas"),
            myOptions
        );
    
        var layer = new google.maps.KmlLayer(
            'http://www.yourserver.com/some.kml', {
                // prevent default behaviour
                suppressInfoWindows: true, 
                map: map
            }
        );
    
        // bind the event handler
        google.maps.event.addListener(layer, 'click', function(kmlEvent) {
            showInfoWindow(kmlEvent.featureData.description);
        });
    
        // show a custom info window
        function showInfoWindow(text) {
            // build your window using whatever, styles, embeds or scripts
            // you like. Anything included here will bypass content scrubbing
            var content = "<div style='margin-left:-20px;border:2px dotted #897823;'>" + text + "</div>";
            var infowindow = new google.maps.InfoWindow({
                content: content
            })
        }
    }
    

    Obviously you can replace style='...' with class='whatever' which would then allow you to define the CSS style in an external file.

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

Sidebar

Related Questions

It seems that licensing terms would prevent us from using Google Maps API in
I want to access some data from Google maps. the only way possible is
I just started working using Google Maps API yesterday, and trying to set up
All the examples I've come across using Google Maps API seem to show a
Update II I Figured this out. When using google maps api, the model must
Using the Google Maps API, how can I get the latitude and longitude of
Using the Google Maps API v3: How do I change the mouse cursor when
We're using the Google Maps API for an application to determine distance and driving
I'm using the Google Maps API v2. I add markers to the map and
I'm using the Google Maps API to build a map full of markers, but

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.