Bing Maps V8 - Map Height/Width - Setting width/height does not work, takes full screen RRS feed

  • Question

  • Bing map v8, doesnt let me control the map width and height as it did in v7. it just takes up the entire screen. Need a quick fix please.
     function GetMap() {
                // Initialize the map
                var mapSettings = {
                    // MapOptions
                    credentials: "",
                    // ViewOptions
                    // default to roughly center of CO.
                    center: new Microsoft.Maps.Location(44.249, -7.536),
                    zoom: 2,
                    enableSearchLogo: false,
                    mapTypeId: Microsoft.Maps.MapTypeId.road,
                    showBreadcrumb: false,// shows the whole state of CO
    		tileBuffer: 4,
    		showScalebar: false,
                    width: 530, 
                    height: 410,
                map = new Microsoft.Maps.Map(document.getElementById("myMap"), mapSettings);
    <body onload="GetMap();">
    <table border=1 width=530px height=410px><tr><td>
    <div id='myMap'>&nbsp;

    Friday, August 26, 2016 1:21 PM


  • The with and height map options have been deprecated in V8. It didn't make sense to have these when the normal way to set the width/height is through CSS. To set the width of your div you can either use inline styles like this:

    <div id='myMap' style='position : relative;width:530px;height:410px;'></div>

    Or use a css class:

    #myMap {
        position : relative;
        width: 530px;
        height: 410px;

    [Blog] [twitter] [LinkedIn]

    Friday, August 26, 2016 3:53 PM