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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

              
                 <H1 class="text-center">Local Weather</H1>
<div class="container-fluid" id="main">
  
    <div class="wrapper">
    <div id="top" class="container-fluid row">
      <h2 id="location"></h2>
      <h2 id="region"></h2>
    </div>

    <div id="middle" class='container-fluid row'>
      <i aria-hidden="true"></i>
      <h3 id="temp"></h3>
    </div>
    <div class="row">
      <p id="summary"></p>
    </div>
    <div class="row container-fluid" id="bottom">
      <button id="click">F/C</button>
    </div>
  </div>
  <!--end main content-->
</div>
<!--end class-->
</div>
              
            
!

CSS

              
                #top{
  margin-top:30px;
  padding-left: 30.5%;
}
#region{
   padding-left: 2.5%;
}

#summary{
 
  width: 400px;
  margin:auto;
  padding-top: 25px;
  text-align: justify;
  margin-bottom: 25px;
   z-index: 1;
}
.wrapper{
  height: 90%;
  width: 33%;
  background: white;
  margin-left: 33%;
  opacity: 0.5;
  border-radius: 15px;
  z-index: -10;
  box-shadow: 3px 3px 3px 3px grey;
}
#bottom{
 padding-left: 45%;
  width: 50px;
}

#middle{
  margin-top: 50px;
padding-left: 33%;
  

}
#temp{
  font-weight: bold;
  margin-top: 10px;
  margin-left: 15%;
}
#date {
  display: inline-block;
  float: left;
}

.day1 {
  background: url(https://c8uhsa.by3302.livefilestore.com/y4manj53NBkTKV3iJ429eZAmOEgdNGjDcxKeG-nEsVWgJFT6xae4C2RZ3FnjQG92ILyamkB3w2VZkRnzCRRuPrK8eppT7ugjjr6-cFiJEuZpI1RkTOXtX8IC2xoTLOGxDRx-H0ND51HK0hMLo4OYl6LjZ4e-sgPZy3k8urVAK3qri_ElsE8oM1QArhQ_x1D36Z1DvlcWU7NHMX9B9XqzcJLzA?width=3361&height=3269&cropmode=none) top center repeat-x #e0d0b7;
}

.day2 {
  background: url(https://csuesa.by3302.livefilestore.com/y4m37RQt8GPhJ3Ta1dq-Af3XFfuW1P8GuJb9ujrKrRG8mA4_5El8drsghOu5p2-fxwsllDQoY1jfiJXy_Cn06XT3ITYuESc1nEtKgjJqWQlbkoinTLipIn3QWUupNAPEGQlAL0Jnl4yfb0JDdB5vp5mr8zFsQrRDjZ6BcP-rdnYU7-4zhZNVxw9phpNwKJ32880KCVv6nE1FjeQ81QNCSpbGQ?width=3264&height=4928&cropmode=none) top center repeat-x #e0d0b7;
}

.day3 {
  background: url(https://ecuhsa.by3302.livefilestore.com/y4mxU9Hy3b2XUmAuOYX9Jxyd4KzRwna26HcH0sVoHBViskaCTqIOMPGy-EZrQedOrjwB_vVNz34glQo5ceFzFnMrulTkvTHpzi1j5eSZ7BhcnfUpH1mpvd0rhBnvofRD6DIK69iytaUKceK49Rxf-4J5pZGUPWwMuT-Nyx_6Uh3lZimb4Csu_-N4uuQo8Tur_BZ-Ixl5AUqVCX1auPG-pjkpw?width=3872&height=2592&cropmode=none) top center repeat-x #e0d0b7;
}

.evening1 {
  background: url(https://dcuesa.by3302.livefilestore.com/y4m3D3zkRdmscaV15s2UoRuDqJI8m5EYWy0AgpUe4861apzvyIB0YmE2kkZb7egHGfTDIg-7_1Rh0CRS1qYFKngyTtIf5UP5tSBgdaAouJCK_pUMXX82Z9TbQSdVdmbuRy4C_KKXeZg8kfHxAd0GwGeEzOhen_dAr_iTadLIygnBeXoaThQrJ691hnNpxbl06MP9wKXxIKUF9vXX6hZpB1swg?width=3872&height=2592&cropmode=none) top center repeat-x #887f70;
}

.evening2 {
  background: url(https://dsxudq.by3302.livefilestore.com/y4mRgVfob0sOGQQ48qoNQvCKwajr4a7mmaZiEa6zxFgxj5ndXzdNUuLfUPKf12_KXz-fTPzXw0Y4aOKJOsVpjcbfkRw5AmJIJy3dH_XfTd_BFEoOu84pLxb7gAEmVc--zxg-ksJk0crPQ_J2l2hzEhUzEVXl7d6AlZ0ryApR-vI2rXm4bkLU66VLH-ri0-nlYa8w4D_ntWdPigyfAT4pzZlfw?width=3220&height=1462&cropmode=none) top center repeat-x #887f70;
}

.evening3 {
  background: url(https://ecudsa.by3302.livefilestore.com/y4mTYa0GK_ltMhCCnCDmHz_4xKvr_MDBwoWzyrjEumI4mlAfQb_1rQMuT0qWLCrZASeg7reCw0NMBNu_NeIZkDqzDQh3m3Z1QFen8FQ16yZjsQUtGaIvxC4GQntIC8QK5gA3edlnfZ_M3aObUxKw_vXGCMWjKCB4YxtE4w-N0Zu7x6VHu0rZR03kqKhNXQHkHnoPP1a-zPfd99H5Yf73NcrUA?width=2409&height=2397&cropmode=none) top center repeat-x #887f70;
}

.noon1 {
  background: url(https://c8udsa.by3302.livefilestore.com/y4mcJ7xUcMuIa3sQ_OCovd9QD9hjUBs7jZJtSRFR_X2xH5wvoz5BweI0FDDaLXEq7hHsFysw7RQjZaWiX1rcgW8L2xLzQg1IOQjJcuZFNoRY9SELeFhpdpwcWFruSoIZAkYdIUBhs2QgYon6zQdjjQ8NEgyracADLBIxpPUY9f4BdC8cfP4k_dLod0Wm67mjv6JRCHDclVRwpzAlY1c_bKxag?width=3872&height=2592&cropmode=none) top center repeat-x #887f70;
}

.noon2 {
  background: url(https://dmufsa.by3302.livefilestore.com/y4m4Ln4iXUx6_p1JPNfrNHJGh3TgSIub2gH8nzk2kqRgCepJ1sUy4WCXIkAzqNGAbL5YiZS_pTg-14RV-Bl41ayrKHzf-FtO-hxwbByNjh-mtzeJ4YYHhlHuLJniR439Fhs_zlSj1qt9JXliDR0OiKdmx2Wx53C3CWbonxUyvLGhVfbEbgZh9bisREBVTbkgmeG7PDYiFnI7dvaAPu_0Mw43A?width=2571&height=2488&cropmode=none) top center repeat-x #887f70;
}

.noon3 {
  background: url(https://c8uesa.by3302.livefilestore.com/y4mBe5zQDiMJNqsEsxe0-zo4myhAMR6Hu3NHUZ9Rd_9rdaSsnoJYx0TbK-btXZI0KyY-TqwuXx6zicc0FY8W0K6iVyQ8rc1efuMc1lrprqC82K0Cni8zfPg_jZNGRCVy2r7v9rxDs80xJmEAE7ZeyoNEPmKEijutQDGe6aXHaMAKShU_tyZhRmFA_hfPZIZJ_403GtSKcIGIhmv9gujrfRH4g?width=4576&height=2300&cropmode=none) top center repeat-x #887f70;
}

#main{
  
  padding-top: 15px;
  background-size:auto ;
height: 100vh;
}
button{
  padding: 15px 25px;
  color: orange;
  background: green;
  border-radius: 10px;
  font-size: 18px;
  box-shadow: 1px 1px orange;
}
h2, h3, p, i{
  color: darkblue;
  text-shadow: 2px 2px 3px darkorange;
}

p{
  font-size: 24px;
  
}

h1{
  font-size:64px;
  font-weight: bold;
  text-shadow: 2px 2px 5px gray;
  padding-bottom: 20px;
  padding-top: 10px;
}
.text-center{
  background: lightgray;
  opacity: 0.4;
  box-shadow: 10px 10px 10px 10px grey;
  width: 100hw;
}
h2{
  font-weight: bold;
  font-size: 36px;
}
              
            
!

JS

              
                
$(document).ready(function() {
  var output = document.getElementById("out");
var key = "5d66e3034c30a2824cedc905b05f0070";
var cel = false;
var wd;
 
function displayTemp(fTemp, c) {
  if (c) return Math.round((fTemp - 32) * (5 / 9)) + " C";
  return Math.round(fTemp) + " F";
}

 function product(wd, cel){
  
  var temp = displayTemp(wd.currently.temperature, cel);
 
     $("#temp").html(temp);
 
 } 

$(function(){
  
  var loc;
  var region;
  var city; 

  $.getJSON("https://ipinfo.io", function(d) {
    loc = d.loc.split(",");
    city = d.city;
    region = d.region;
     
 var CurrentRegion = d.region;
 var Currentlocation = d.city;   

    $("#region").html(CurrentRegion);
    $("#location").html(Currentlocation);


    $.getJSON(
      "https://cors-anywhere.herokuapp.com/https://api.darksky.net/forecast/" +
        key +
        "/" +
        loc[0] +
        "," +
        loc[1],
       
      function(ad){
        
        wd = ad;
        product(ad, cel);
        var sum = wd.daily.summary;
    $("#summary").html(sum);
        var icon = wd.currently.icon;
  console.log(icon);
      switch(icon){
        case 'clear-day':
          $('i').attr("class","fa fa-sun-o fa-5x col-md-2 text-center");
          break;
        case 'clear-night':
          $('i').attr("class","fa fa-moon-o fa-5x col-md-2 text-center");
          break;
        case 'rain':
          $('i').attr("class","fa fa-tint fa-5x col-md-2 text-center");
          break;
        case 'snow':
          $('i').attr("class","fa fa-snowflake-o fa-5x col-md-2 text-center");
          break;
        case 'sleet':
          $('i').attr("class","fa fa-snowflake-o fa-5x col-md-2 text-center");
          break;
        case 'wind':
          $('i').attr("class","fa fa-leaf fa-5x col-md-2 text-center");
          break;
        case 'fog':
          $('i').attr("class","fa fa-low-vision fa-5x col-md-2 text-center");
          break;
        case 'cloudy':
          $('i').attr("class","fa fa-cloud fa-5x col-md-2 text-center");
          break;
        case 'partly-cloudy-day':
          $('i').attr("class","fa fa-cloud fa-5x col-md-2 text-center");
          break;
        case 'partly-cloudy-night':
          $('i').attr("class","fa fa-cloud fa-5x col-md-2 text-center");
          break;
        default:
          $('i').attr("class","fa fa-question-circle fa-5x col-md-2 text-center");
      }    
  });
    
        $("#click").click(function() {
          cel = !cel;
          product(wd, cel);  
           });
  });
});
  
  //background 
  function randOrd() {
  return (Math.round(Math.random()) - 0.3);
}

$(document).ready(function() {
  var today = new Date();
  var hourNow = today.getHours();
  var script = document.getElementById('date');
  
  if (hourNow < 12) {
  
    var days = ['day1', 'day2', 'day3'];
    days.sort(randOrd);
    $('#main').each(function(i, val) {
      $(this).addClass(days[i]);
      script.outerHTML += '<h2>Morning</h2>' + Date();
    });
    
  } 
  
  else if (hourNow >= 12 && hourNow <= 17) {
  
    var noon = ['noon1', 'noon2', 'noon3'];
    noon.sort(randOrd);
    $('#main').each(function(i, val) {
      $(this).addClass(noon[i]);
      script.outerHTML += '<h2>Afternoon</h2>' + Date();
    });
    
  } 
  
  else if (hourNow > 17 && hourNow <= 24) {
  
    var evening = ['evening1', 'evening2', 'evening3'];
    evening.sort(randOrd);
    $('#main').each(function(i, val) {
      $(this).addClass(evening[i]);
      script.outerHTML += '<h2>Evening</h2>' + Date();
    });
    
  } 
  
  else /* the hour is not between 0 and 24, so something is wrong */ {
    alert("I'm not sure what time it is!");
  }
});
});

              
            
!
999px

Console