Skip to content

Instantly share code, notes, and snippets.

@kyletolle
Last active August 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kyletolle/dada6235813d6ce54de6 to your computer and use it in GitHub Desktop.
Save kyletolle/dada6235813d6ce54de6 to your computer and use it in GitHub Desktop.
Minimal Leaflet Page
<!DOCTYPE html>
<html>
<head>
<title>Minimal Leaflet Page</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" />
<style>
html, body, #map { margin: 0; height: 100%; width: 100%; }
</style>
<script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script>
</head>
<body>
<div id="map"></div>
<script type="text/javascript">
var map = L.map('map').setView([37.8, -96], 3);
<!-- http://switch2osm.org/using-tiles/getting-started-with-leaflet/ -->
var osmUrl='http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
var osmAttrib='Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors';
var osm = new L.TileLayer(osmUrl, {minZoom: 2, maxZoom: 12, attribution: osmAttrib})
map.addLayer(osm);
</script>
</body>
</html>
@cbachich
Copy link

Please make this take up the full page.

body {
padding: 0;
margin: 0;
}
html, body, #map {
height: 100%;
}

@kyletolle
Copy link
Author

Thanks @cbachich for the idea. I've updated the code above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment