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.


                <div class="container-fluid">
  <div class="content">
    <h2 class="btn btn-info"></h2>
    <img src=""></img>
  <form class="options">
    <input type="text" placeholder="Enter Zipcode">
    <button type="submit" class="btn-danger">Check Weather</button>


                body {
  background-image: url("");
  background-size: cover;
  background-repeat: no-repeat;

.container-fluid  {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  height: 250px;
  width: 500px;

.content {
  text-align: center;

input {
  vertical-align: baseline;

button {
  border-radius: 2px;

.options {
  text-align: center;

button[type=submit] {
  border-radius: 5px;


  var location = {
    current: function(){
      var coordinates = function(data){
        latitude = data.coords.latitude;
        longitude = data.coords.longitude;
        loadAPI("local", [latitude, longitude]);
    zipCode: function(e){
      var zipCode = $("input").val();
      loadAPI("zipcode", zipCode);
  var loadAPI = function(type, input){
    var query = type;
    var url;
    if(query === "local"){
      url = "" + input[0] + "&lon=" + input[1];
      $.getJSON(url, weatherDetails);
    } else if(query === "zipcode"){
      url = "" + input + ",us&appid=380f305bc81a49b6b10c1cfd99fd32fd&units=metric";
      $.getJSON(url, weatherDetails);
  var weatherDetails = function(data){
    var city =;
    var temperature = {
      celsius: data.main.temp + " &#8451",
      fahrenheit: data.main.temp * 1.8 + 32 + " &#8457"
  //  var image =[0].icon;

  var description = function(){
      var description =[0].description.split(" ");
      var newDescription = [];
        newDescription.push(description[i].replace(description[i][0], description[i][0].toUpperCase()));
      return newDescription.join(" "); // background image doesn't work when returned
    displayWeather([city, temperature, description()]); // description needs to be called to return the value;
  var displayWeather = function(input){  
    var fahrenheit = false;
    var toggleTemp = function(e){
        fahrenheit = true;
      } else {
        fahrenheit = false;
    $("h2").on("click", toggleTemp);
    var backgroundImage = function(desc){
      desc = desc.toLowerCase();
      if(desc.includes("clear") || desc.includes("cloud")){
        $("body").css("background-image", "url(");
      } else if (desc.includes("rain")){
        $("body").css("background-image", "url(");
      } else if (desc.includes("sun")){
        $("body").css("background-image", "url(");
      } else if (desc.includes("snow")){
        $("body").css("background-image", "url(");