Pen Settings



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


Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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


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.


                <body class="main">

  <h1 class="main-header color" id="main-header">Local Weather</h1>

  <div class="date color" id="date"></div> <!-- div for the date and time -->

  <div class="location color" id="location"></div> <!-- div for geo-location -->

  <div class="temp color" id="temp"></div> <!-- div for temperatures -->

  <button type="button" class="color" id="far">F&deg</button>

  <button type="button" class="color" id="cel">C&deg</button>



                * {
  box-sizing: border-box;
body {
  background: url() no-repeat center center fixed;
  background-size: cover;
  text-align: center;
h1 {
  font-size: 5em;
  color: wheat;
h1 {
  letter-spacing: 10px;
  font-weight: lighter;
  font-family: Optima, serif;
button {
  height: 75px;
  width: 100px;
  border: 5px solid wheat;
  border-radius: 10%;
  font-size: 2.5em;
  color: wheat;
  background-color: transparent;
  outline: none;
button:hover {
  background-color: rgba(0,0,0,0.5);


                const userLocation = document.getElementById('location');
const localTemp = document.getElementById('temp');

// Main Function

function geoFindMe() {

  // GeoLocation API
  $.getJSON('').done(function (place) {

    $('#location').html( + ', ' + place.region_code);

    // Weather API
    $.getJSON('' + place.latitude + '&lon=' + place.longitude +
    '&units=imperial&appid=4a57261bd57c7c76003822133b03c5b8', function (data) {

        localTemp.innerHTML = Math.round(data.main.temp) + 'F';

        // Event Listener for Celcius button
        $('#cel').click(function () {
          let fTemp = data.main.temp;
          const fToCel = (fTemp - 32) * 5 / 9;
          localTemp.innerHTML = Math.round(fToCel) + 'C';
        // Event Listener for Farenhiet button
        $('#far').click(function () {
          localTemp.innerHTML = Math.round(data.main.temp) + 'F';

        // Conditionals to change background pictures
        if (data.cod < 300) {
          $('.main').css('background-image', 'url(images/thunderstorm.jpeg)');
          $('.color').css('color', 'wheat');
          $('.color').css('border-color', 'wheat');
        }else if (data.cod < 600) {
          $('.main').css('background-image', 'url(images/rain.jpeg)');
          $('.color').css('color', 'white');
          $('.color').css('border-color', 'white');
        }else if (data.cod < 700) {
          $('.main').css('background-image', 'url(images/snow.jpeg)');
          $('.color').css('color', 'black');
          $('.color').css('border-color', 'black');
        }else if (data.cod < 800) {
          $('.main').css('background-image', 'url(images/fog.jpg)');
          $('.color').css('color', 'black');
          $('.color').css('border-color', 'black');
        }else if (data.cod > 800) {
          $('.main').css('background-image', 'url(images/cloudy.jpeg)');
          $('.color').css('color', 'black');
          $('.color').css('border-color', 'black');
        }else if (data.cod == 800) {
          $('.main').css('background-image', 'url(images/sunny.jpg)');
          $('.color').css('color', 'black');
          $('.color').css('border-color', 'black');

// Sets the Date

function date() {
  var currentDate = document.getElementById('date');
  var d = new Date();
  var str = (d.getMonth() + 1) + '/' + d.getDate() + '/' + d.getFullYear();
  currentDate.innerHTML = str;