Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <!--[if lte IE 8]>
     <link rel="stylesheet" href="" />
<h1>Building Interactive Maps with Leaflet &amp; the Geo&#8203;location API</h1>
<div id="leafletmap"></div>
<i class="fa fa-map-marker"></i>
<button class="pure-button pure-button-primary">Get my location</button>


                @import url(;
html{background: #111;}
  max-width: 500px;
  margin: 1em auto;
  text-align: center;
  background: #fff;
  border: 1px solid #ccc;
  padding: 0 25px;
  border-radius: 3%;
  height: 300px;
  border: 1px solid #ccc;
  margin: 1.5em;


                var mymap ='leafletmap');
mymap.setView([40.775,-73.972], 15);
L.tileLayer('http://{s}{z}/{x}/{y}.png', {
    attribution: 'Map data &copy; <a href="">OpenStreetMap</a> contributors, <a href="">CC-BY-SA</a>',
    maxZoom: 18

$('.pure-button').on('click', function(){
  mymap.locate({setView: true, maxZoom: 15});

mymap.on('locationfound', onLocationFound);
function onLocationFound(e) {
    // e.heading will contain the user's heading (in degrees) if it's available, and if not it will be NaN. This would allow you to point a marker in the same direction the user is pointed.