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.

Editor Settings

Code Indentation

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

Visit your global Editor Settings.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.


              <div class="container-fluid text-center weather">
  <h1>Local Weather</h1>
  <!-- list of weather information to display -->
  <ul class="list-unstyled">
    <li id="location"></li>
    <li class="btn btn-default" id="temp"></li>
    <li  id="description"></li>
    <li id="icon"></li>
  <p>If this page does not load the weather, remove the https:// from your address bar. Also, may not work correctly in Safari.</p>


body {
  font-size: 18px;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;

h1 {
  color: Blue;

ul {
  list-style: none;
  color: black;


  // declare variables
  var lati;
  var longi;  
  var name;
  var description;
  var temp;
  var farenheit;
  var celsius;
  var tempSwitch = false;
  var icon;
  // gets location based on ip address
    lati =;
    longi = data.lon;
    // sends lat and lot to getData method
    getData(lati, longi);
  function getData(lati, longi) {
    var api = ''+lati+'&lon='+longi+'&appid=27fee676035d13ce03a3e92c472d2594';
    // gets weather information based on lat and long passed in.
    // assigns returned data to variables
      name =;
      description =[0].description;
      temp = data.main.temp;
      farenheit = ((temp)*(9/5)-459.67).toFixed(2);
      celsius = (temp - 273).toFixed(2);
      //sends info to displayData to display it on the screen.
      displayData(name, description, temp, farenheit, celsius);
  function displayData(name, description, temp, farenheit, celsius){
    $("#temp").html(farenheit + " F");
    // based on weather description, sets different backgrounds
      case "clear sky":
        $('body').css('background-image', 'url(');
      case "few clouds":
        $('body').css('background-image', 'url(');
      case "scattered clouds":
        $('body').css('background-image', 'url(');
      case "broken clouds":
        $('body').css('background-image', 'url(');
      case "shower rain":
        $('body').css('background-image', 'url(');
      case "rain":
        $('body').css('background-image', 'url(');
      case "thunderstorm":
        $('body').css('background-image', 'url(');
      case "snow":
        $('body').css('background-image', 'url(');
      case "mist":
        $('body').css('background-image', 'url(');
    // clicking on the temp switches between Fahrenheit and celsius
      if(tempSwitch === false){
        $("#temp").html(celsius + " C");
        tempSwitch = true;
    else {
      $("#temp").html(farenheit + " F");
      tempSwitch = false;