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

              
                <head>
<link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet">
  <link href="https://fonts.googleapis.com/css?family=Zilla Slab" rel="stylesheet">
</head>
<body>
  <div align="center" class="center" id="background">

<div class="center" id="body-box">
    <div class="center" id="content">
      <div id="content-box" class="row center box">
        <div id="top-box">Today's Weather</div>
        <div id="location-box" class="row center box">Location</div>
        <div id="weather-box" class="row center box">Weather</div>
        <div id="button-box">
          <button id="change-button"></button></div>
        <div id="icon-box" class="row center box">Icon</div>
        <div id="bottom-box" class="row center box">Data from Weather Underground</div>
          </div>
        </div>
      </div>
    </div>
  </div>
</body>
              
            
!

CSS

              
                @media screen and (max-width: 992px) {
  p,.btn,input,div,span,h4,#intro-text {
    font-size: 95%;
  }
  h1 {
    font-size: 30px;  
  }
  h2 {
    font-size: 25px;  
  }
  h3 {
    font-size: 18px;  
  }
}

@media screen and (max-width: 768px) {
  p,.btn,input,div,span,h4,#intro-text {
    font-size: 93%;
  }
  h1 {
    font-size: 25px;  
  }
  h2 {
    font-size: 22px;  
  }
  h3 {
    font-size: 16px;  
  }

}
a:active {
  border: 0;
}
a:hover {
  border: 0;
}
a:link {
  border: 0;
}
body {
  background-image: url("https://asphoria.files.wordpress.com/2017/07/stock-weather2.jpeg");
background-size: cover;
  background-attachment: fixed;
    margin:0;
}
#background {
  margin: auto;
  align-items: center;
  display: flex;
  height: 95vh;
}
#body-box {
    width: 100%;
  margin: 0 auto;
}
#content {
  width: 40em;
  background-color: rgba(200,200,200,0.4);
  margin: 0 auto;
  color: black;  
  border: 1.5px solid black;
}
.flex-container {
  flex-direction: column;
  vertical-align: center;
  margin: auto;
  align-items: center;
}
#content-box {
  height: 100%;
  width: 98%;
  margins: auto;
}
#top-box {
  font-family: "Lobster";
  font-size: 2em;
}
.box {
  width: 100%;
  margin: auto;
  font-size: 1.5em;
  font-family: "Zilla Slab";
}
#weather-box {
   font-weight: bold;
   padding: .5em .5em 0em .5em;
}
#button-box {
  margin-top: -.5em;
}
button {
  font-size: .6em;
  background: grey;
  border: 0;
  color: black;
  font-family: verdana;
  border: 1px solid darkgrey;
  border-radius: 6px;
}
#icon-box {
   padding: .5em;
}
#bottom-box {
  font-size: .7em;
}
              
            
!

JS

              
                var currentButton = ""
var c = ""
var f = ""

function cToF(celsius) 
{
  var cTemp = celsius;
  var cToFahr = cTemp * 9 / 5 + 32;
  var message = cTemp+'\xB0C is ' + cToFahr + ' \xB0F.';
    console.log(message);
}

function fToC(fahrenheit) 
{
  var fTemp = fahrenheit;
  var fToCel = (fTemp - 32) * 5 / 9;
  var message = fTemp+'\xB0F is ' + fToCel + '\xB0C.';
    console.log(message);
} 

function changeMeasurement() {
  if (currentButton == "to Celsius") {
    $("#weather-box").html(c);
    $("#change-button").html("to Fahrenheit");
    currentButton = "to Fahrenheit";
  }
  else if (currentButton == "to Fahrenheit") {
    $("#weather-box").html(f);
    $("#change-button").html("to Celsius");
    currentButton = "to Celsius";
  }
}

  
$(document).ready(function() {
  $.getJSON("https://api.wunderground.com/api/6ed0b48cbea09ca1/conditions/q/autoip.json", function(weather) {
    c = weather.current_observation.temp_c + " c, " + weather.current_observation.weather;
    f = weather.current_observation.temp_f + " f, " + weather.current_observation.weather;
      $("#location-box").html(weather.current_observation.display_location.full)
      $("#weather-box").html(f)
      $("#icon-box").html("<img src='" + weather.current_observation.icon_url + "'>")
    $("#change-button").html("to Celsius")
    currentButton = "to Celsius"
    }
              );
  $("#change-button").on("click", function() {
    changeMeasurement();
    });
  
  }
                        );





              
            
!
999px

Console