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.


                <div id="container">
  <div class="inner-container">
    <div class="box box-50">
      <div class="boxin">
        <div class="header">
          <h3>HTML5 Static Map Geo-Location</h3>
        <div class="content">
          <ul class="simple">
            <li class="even">
              <span id="msg"></span>
            <li class="odd">
              <strong>Your Latitude</strong>
              <span id="lat"></span>
            <li class="even">
              <strong>Your Longitude</strong>
              <span id="lng"></span>
            <li class="odd">
              <strong>Accuracy (in Meters)</strong>
              <span id="acc"></span>
          <div id="map">
            Note: May take a few seconds to get the location.



                @import url("");

#msg {
  font-weight: bold;

#map {
  margin: 20px 0px 20px;
  padding-left: 20px;
  width: 100%;
  height: 100%;
  position: relative;
  font-style: italic;



                n_a = 'HTML5 Geolocation supported, but location data is currently unavailable.'
url = ''
lat = lng = acc = null

$msg = $('#msg')

ok = (e) ->
  at = e.coords
  lat = at.latitude;
  lng = at.longitude;
  acc = at.accuracy;
  if lat and lng
    for name, val of { lat, lng, acc }
      localStorage[name] = val

updateDisplay = ->
  at = [lat, lng] + ''
  map = "<img src='#{url}&zoom=16&center=#{at}'/>"
  map = "{at}&z=16"
  for id, val of { map, lat, lng, acc }

fail = (err) ->
  msg = [ "There was an error while retrieving your location: #{err.message}"
        , 'The user prevented this page from retrieving a location.'
        , "The browser was unable to determine your location: #{err.message}"
        , 'The browser timed out before retrieving the location.'
  $msg.text(msg).css('color', '#D03C02')

window.reset = ->
  delete localStorage[name]  for name in ['lat', 'lng', 'acc']
  $msg.text('localStorage cleared.')

if navigator.geolocation
  do load = ->
      .html('HTML5 Geolocation is supported in your browser.')
      .css('color', '#1ABC3C')
    if localStorage?.lat
      lat =
      lng = localStorage.lng
      acc = localStorage.acc
      $msg.html('Location data retrieved from localStorage. <a id="reset" href="javascript:reset();" style="margin-left: 15px;">delete</a>')
      navigator.geolocation.getCurrentPosition ok, fail, timeout: 10e3