function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
mattytreksmattytreks 

Center Google Map frame on Visualforce Page?

Hello All- my Google Map Visualforce Page is up and running, however the last piece of functionality I'd like to implement is to center-align the map on the Record Detail Page.

Below is a code snippet along with a screenshot of how it's currently rendering.  I've tried inserting align="center" in my <style> section, however it does not center.  Where am I going wrong?  Thank you!
function resizeIframe() {
    var me = window.name;
    if (me) {
      var iframes = parent.document.getElementsByName(me);
      if (iframes && iframes.length == 1) {
        height = document.body.offsetHeight;
        iframes[0].style.height = height + "px";
      }
    }
  }
  
});
</script>
 
<style>
#map {
  font-family: Arial;
  font-size:12px;
  line-height:normal !important;
  height:300px;
  width: 800px;
  align="center";
  background:transparent;
}
</style>
 
</head>
 
<body>
<div id="map"></div> 
</body> 
</apex:pageBlock>
</apex:page>
Screenshot
Naval Sharma4Naval Sharma4
Hi Matty,

Try this one.
function resizeIframe() {
    var me = window.name;
    if (me) {
      var iframes = parent.document.getElementsByName(me);
      if (iframes && iframes.length == 1) {
        height = document.body.offsetHeight;
        iframes[0].style.height = height + "px";
      }
    }
  }
  
});
</script>
 
<style>
#map {
  font-family: Arial;
  font-size:12px;
  line-height:normal !important;
  height:300px;
  width: 800px;
  align="center";
  background:transparent;
}
</style>
 
</head>
 
<body>
<center>
<div id="map"></div> 
</center>
</body> 
</apex:pageBlock>
</apex:page>

Regards,
Naval