Hide Table of Contents
View Full map layout with border and margin sample in sandbox
Full map layout with border and margin

Description

This sample shows how to use the Dojo layout widgets to create a layout with a Map shown at 95% width and height with a border and a 2% margin. This layout is ideal to show a background image or color to match another site.

Code

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    
    <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/>
    <title>Full Map Layout - Border and Margin</title>

    <link rel="stylesheet" href="https://js.arcgis.com/3.46/dijit/themes/claro/claro.css">
    <link rel="stylesheet" href="https://js.arcgis.com/3.46/esri/css/esri.css">
    <style>
      html, body {
        height: 100%; width: 100%;
        margin: 0; padding: 0;
      }
      body{
        background-color:#feffff; overflow:hidden;
        font-family: "Trebuchet MS";
        margin: 2%;
      }
      #map{
        border-radius: 4px;
        overflow: hidden;
        border:solid 4px #799d15;
      }
    </style>

    <script>var dojoConfig = { parseOnLoad: true };</script>
    <script src="https://js.arcgis.com/3.46/"></script>
    <script>
      dojo.require("dijit.layout.BorderContainer");
      dojo.require("dijit.layout.ContentPane");
      dojo.require("esri.map");

      var map;

      function init() {
        map = new esri.Map("map", {
          basemap: "streets-vector",
          center: [-102.524, 46.937],
          zoom: 4
        });
      }
      dojo.ready(init);
    </script>
  </head>
  <body class="claro">
    <div data-dojo-type="dijit.layout.BorderContainer" data-dojo-props="design:'headline', gutters:false" style="width: 96%; height: 94%;">
      <div id="map" data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'center'">
      </div>
    </div>
  </body>

</html>
 
          
Show Modal