Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

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

Packages

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.

Behavior

Save Automatically?

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.

HTML

              
                <html>
<head>
  <meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0">
<title>Weather App</title>
  <link href="https://fonts.googleapis.com/css?family=Montserrat:400,700,inherit,400" rel="stylesheet" type="text/css">
</head>
<body class="body page-index clearfix">
  <div class="container clearfix">
    <p class="location"></p>
    <p class="temperature"></p>
    <div class="climate_bg">
    </div>
    <div class="info_bg">
      <img class="dropicon" src="https://googledrive.com/host/0Byi7CVy901YhLXVrTWx6QkZDZzA/Droplet.svg">
      <p class="humidity"></p>
      <img class="windicon" src="https://googledrive.com/host/0Byi7CVy901YhLXVrTWx6QkZDZzA/Wind.svg">
      <div class="windspeed"></div>
    </div>
  </div>
</body>
</html>
              
            
!

CSS

              
                  body {
  background-color: #bebebe;
  font: 400 1em/1.38 Montserrat;
  color: #ffffff;
}

.info_bg p {
  margin-bottom: -.2em;
}

.climate_bg {
  position: absolute;
  top: 0;
  left: 235px;
  z-index: 6;
  width: 163px;
  height: 149px;
  border-top-right-radius: 10px;
  background-color: rgb(255, 255, 255);
}

.weathericon {
  display: block;
  position: absolute;
  top: -5px;
  left: 1.226993865%;
  z-index: 5;
  width: 160px;
  height: auto;
  overflow: hidden;
}

.container {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9;
  width: 398px;
  height: 208px;
  margin: auto;
  border-radius: 10px;
  background-color: rgb(0, 0, 0);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  opacity: 0.8;
}

.dropicon {
  display: block;
  position: absolute;
  top: 9px;
  left: -3.9110429448%;
  z-index: 3;
  width: 41px;
  height: auto;
  overflow: hidden;
}

.not-available, .failed {
  position: absolute;
  top: 464px;
  left: 0;
  right: 0;
  z-index: 10;
  width: 248px;
  min-height: 24px;
  margin: 0 auto;
  font: 0.625em/1.38 'Trebuchet MS';
  color: rgb(0, 0, 0);
}

.humidity {
  position: absolute;
  top: 19px;
  left: 29px;
  z-index: 2;
  width: 46px;
  min-height: 29px;
  font-size: 1em;
  line-height: 1.38;
  text-align: center;
  color: #ffffff;
}

.info_bg {
  position: absolute;
  top: 149px;
  left: 235px;
  z-index: 4;
  width: 163px;
  height: 59px;
  border-bottom-right-radius: 10px;
  background-color: #1ab1ed;
}

.location {
  position: absolute;
  top: 128px;
  left: 63px;
  z-index: 8;
  width: 108px;
  min-height: 59px;
  font-size: 1.313em;
  font-weight: 400;
  line-height: 1.38;
  text-transform: uppercase;
  color: rgb(255, 255, 255);
}

.temperature {
  position: absolute;
  top: 38px;
  left: 72px;
  z-index: 7;
  width: 109px;
  min-height: 28px;
  font-size: 4.25em;
  font-weight: 700;
  line-height: 1.38;
  color: rgb(255, 255, 255);
}

.windicon {
  display: block;
  position: absolute;
  top: 5px;
  left: 43.1173312883%;
  z-index: 1;
  width: 50px;
  height: auto;
  overflow: hidden;
}

.windspeed {
  position: absolute;
  top: 9px;
  left: 109px;
  width: 50px;
  min-height: 29px;
  font-size: 1em;
  line-height: 1.38;
  text-align: center;
  color: #ffffff;
}

.windspeed p {
  margin-bottom: -.2em;
}
/*! normalize.css v2.1.0 | MIT License | git.io/normalize */

/* ==========================================================================
   HTML5 display definitions
   ========================================================================== */

/**
 * Correct `block` display not defined in IE 8/9.
 */

article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
main,
nav,
section,
summary {
    display: block;
}

/**
 * Correct `inline-block` display not defined in IE 8/9.
 */

audio,
canvas,
video {
    display: inline-block;
}

/**
 * Prevent modern browsers from displaying `audio` without controls.
 * Remove excess height in iOS 5 devices.
 */

audio:not([controls]) {
    display: none;
    height: 0;
}

/**
 * Address styling not present in IE 8/9.
 */

[hidden] {
    display: none;
}

/* ==========================================================================
   Base
   ========================================================================== */

/**
 * 1. Set default font family to sans-serif.
 * 2. Prevent iOS text size adjust after orientation change, without disabling
 *    user zoom.
 * 3. Ensure that the HTML is always 100% height. This fixed body height issues in Chrome for example.
 */

html {
    font-family: sans-serif; /* 1 */
    -webkit-text-size-adjust: 100%; /* 2 */
    -ms-text-size-adjust: 100%; /* 2 */
    min-height: 100%;
}

/**
 * Remove default margin.
 */

body {
    margin: 0;
}

/* ==========================================================================
   Links
   ========================================================================== */

/**
 * Address `outline` inconsistency between Chrome and other browsers.
 */

a:focus {
    outline: thin dotted;
}

/**
 * Improve readability when focused and also mouse hovered in all browsers.
 */

a:active,
a:hover {
    outline: 0;
}

/* ==========================================================================
   Typography
   ========================================================================== */

/**
 * Address variable `h1` font-size and margin within `section` and `article`
 * contexts in Firefox 4+, Safari 5, and Chrome.
 */

h1 {
    font-size: 2em;
    margin: 0.67em 0;
}

/**
 * Address styling not present in IE 8/9, Safari 5, and Chrome.
 */

abbr[title] {
    border-bottom: 1px dotted;
}

/**
 * Address style set to `bolder` in Firefox 4+, Safari 5, and Chrome.
 */

b,
strong {
    font-weight: bold;
}

/**
 * Address styling not present in Safari 5 and Chrome.
 */

dfn {
    font-style: italic;
}

/**
 * Address differences between Firefox and other browsers.
 */

hr {
    -moz-box-sizing: content-box;
    box-sizing: content-box;
    height: 0;
}

/**
 * Address styling not present in IE 8/9.
 */

mark {
    background: #ff0;
    color: #000;
}

/**
 * Correct font family set oddly in Safari 5 and Chrome.
 */

code,
kbd,
pre,
samp {
    font-family: monospace, serif;
    font-size: 1em;
}

/**
 * Improve readability of pre-formatted text in all browsers.
 */

pre {
    white-space: pre-wrap;
}

/**
 * Set consistent quote types.
 */

q {
    quotes: "\201C" "\201D" "\2018" "\2019";
}

/**
 * Address inconsistent and variable font size in all browsers.
 */

small {
    font-size: 80%;
}

/**
 * Prevent `sub` and `sup` affecting `line-height` in all browsers.
 */

sub,
sup {
    font-size: 75%;
    line-height: 0;
    position: relative;
    vertical-align: baseline;
}

sup {
    top: -0.5em;
}

sub {
    bottom: -0.25em;
}

/* ==========================================================================
   Embedded content
   ========================================================================== */

/**
 * Remove border when inside `a` element in IE 8/9.
 */

img {
    border: 0;
}

/**
 * Correct overflow displayed oddly in IE 9.
 */

svg:not(:root) {
    overflow: hidden;
}

/* ==========================================================================
   Figures
   ========================================================================== */

/**
 * Address margin not present in IE 8/9 and Safari 5.
 */

figure {
    margin: 0;
}

/* ==========================================================================
   Forms
   ========================================================================== */

/**
 * Define consistent border, margin, and padding.
 */
fieldset {
    margin: 0 2px;
    padding: 0.35em 0.625em 0.75em;
}

/**
 * 1. Correct `color` not being inherited in IE 8/9.
 * 2. Remove padding so people aren't caught out if they zero out fieldsets.
 */

legend {
    border: 0; /* 1 */
    padding: 0; /* 2 */
}

/**
 * 1. Correct font family not being inherited in all browsers.
 * 2. Correct font size not being inherited in all browsers.
 * 3. Address margins set differently in Firefox 4+, Safari 5, and Chrome.
 */

button,
input,
select,
textarea {
    font-family: inherit; /* 1 */
    font-size: 100%; /* 2 */
    font-weight: inherit; /* 1 */
    margin: 0; /* 3 */
    padding: 0;
}

/**
 * Remove the default button background color that browsers set
 */

button {
    background: transparent;
}

/**
 * Address Firefox 4+ setting `line-height` on `input` using `!important` in
 * the UA stylesheet.
 */

button,
input {
    line-height: normal;
}

/**
 * Address inconsistent `text-transform` inheritance for `button` and `select`.
 * All other form control elements do not inherit `text-transform` values.
 * Correct `button` style inheritance in Chrome, Safari 5+, and IE 8+.
 * Correct `select` style inheritance in Firefox 4+ and Opera.
 */

button,
select {
    text-transform: none;
}

/**
 * Make sure selects don't get the default browser styles.
 */
select {
  -webkit-appearance: none;
}


/**
 * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`
 *    and `video` controls.
 * 2. Correct inability to style clickable `input` types in iOS.
 * 3. Improve usability and consistency of cursor style between image-type
 *    `input` and others.
 */

button,
html input[type="button"], /* 1 */
input[type="reset"],
input[type="submit"] {
    -webkit-appearance: button; /* 2 */
    cursor: pointer; /* 3 */
}

/**
 * Re-set default cursor for disabled elements.
 */

button[disabled],
html input[disabled] {
    cursor: default;
}

/**
 * 1. Address box sizing set to `content-box` in IE 8/9.
 * 2. Remove excess padding in IE 8/9.
 */

input[type="checkbox"],
input[type="radio"] {
    box-sizing: border-box; /* 1 */
    padding: 0; /* 2 */
}

/**
 * 1. Address `appearance` set to `searchfield` in Safari 5 and Chrome.
 * 2. Address `box-sizing` set to `border-box` in Safari 5 and Chrome
 *    (include `-moz` to future-proof).
 */

input[type="search"] {
    -webkit-appearance: textfield; /* 1 */
    -moz-box-sizing: content-box;
    -webkit-box-sizing: content-box; /* 2 */
    box-sizing: content-box;
}

/**
 * Remove inner padding and search cancel button in Safari 5 and Chrome
 * on OS X.
 */

input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
    -webkit-appearance: none;
}

/**
 * Remove inner padding and border in Firefox 4+.
 */

button::-moz-focus-inner,
input::-moz-focus-inner {
    border: 0;
    padding: 0;
}

/**
 * 1. Remove default vertical scrollbar in IE 8/9.
 * 2. Improve readability and alignment in all browsers.
 * 3. Disable resizing by default.
 */

textarea {
    overflow: auto; /* 1 */
    vertical-align: top; /* 2 */
    resize: none; /* 3 */
}

/* ==========================================================================
   Tables
   ========================================================================== */

/**
 * Remove most spacing between table cells.
 */

table {
    border-collapse: collapse;
    border-spacing: 0;
}



html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
  margin: 0;
  padding: 0;
  border: 0;
  outline: 0;
  font-weight: inherit;
  font-style: inherit;
  font-size: 100%;
  font-family: inherit;
  vertical-align: baseline;
}
/* remember to define focus styles! */
:focus {
  outline: 0;
}
body {
  line-height: 1;
  color: black;
  background: white;
}
ol, ul, li {
  list-style: none;
}
/* tables still need 'cellspacing="0"' in the markup */
table {
  border-collapse: separate;
  border-spacing: 0;
}
caption, th, td {
  text-align: left;
  font-weight: normal;
}
blockquote:before, blockquote:after,
q:before, q:after {
  content: "";
}
blockquote, q {
  quotes: "" "";
}
a,
a:hover,
a:visited {
  text-decoration: none;
}
button,
input,
fieldset,
textarea,
select {
  font-size: inherit;
  color: inherit;
  border: none;
  border-radius: 0;
}
img {
  width: 100%;
  height: auto;
}
.clearfix:before, .clearfix:after { content: ""; display: table; }
.clearfix:after { clear: both; }
.clearfix { *zoom: 1; }

* {
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}

              
            
!

JS

              
                navigator.geolocation.getCurrentPosition(success, error);

      function success(position) {
          var lat = position.coords.latitude;
          var lon = position.coords.longitude;
          var GEOCODING = 'https://crossorigin.me/https://maps.googleapis.com/maps/api/geocode/json?latlng=' + lat + '%2C' + lon + '&language=en';

          $.getJSON(GEOCODING).done(function(location) {
            console.log(location);
            var address = location.results[2].formatted_address;
            $("#long").html(address);
            getweather(address);
          })

      }

      function error(err) {
          console.log(err)
      }
$(document).ready(function() {
  setInterval(simpleWeather, 1000);
});
function getweather(address){
  $.simpleWeather({
    location: address,
    woeid: '',
    unit: 'c',
    success: function(weather) {
      console.log(weather);
      var city = weather.city;
      var temp = weather.temp + "&deg;"+weather.units.temp;
      var wcode = '<img class="weathericon" src="https://googledrive.com/host/0Byi7CVy901YhLXVrTWx6QkZDZzA/'+weather.code+'.svg">';
      var wind = '<p>' + weather.wind.speed + '</p><p>' + weather.units.speed + '</p>';
      var humidity = weather.humidity + " %";

      $(".location").text(city);
      $(".temperature").html(temp);
      $(".climate_bg").html(wcode);
      $(".windspeed").html(wind);
      $(".humidity").text(humidity);
    },
    error: function(error) {
      $(".error").html('<p>' + error + '</p>');
    }
  });
}
              
            
!
999px

Console