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 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


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.


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.


  <h1 class="text-center">Weather App</h1>
  <div class="location text-center">
    <button class="btn btn-default temperature text-center"></button>
    <p>(click for °C/°F)</p>
  <div class="weather text-center">
  <div class="icon text-center">



                h1 {
  margin-top: 20px;
  margin-bottom: 40px;
  font-size: 60px;

.location, .temperature, .weather, .icon {
  margin: 15px;
  font-size: 25px;

.temperature {
  cursor: pointer;
  margin-bottom: 0px;
  background-color: #D6FFB7;
  border: 1px solid black;

div {
  text-align: center;

body {
  background-color: #D6FFB7;

p {
  margin-top: 0px;



                $(document).ready(function() {

  var a = "";

  $.getJSON(a, function(json) {
    $(".location").html( + ", " + json.country_code);

    var b = "" + + json.country_code + "&units=metric&APPID=3a3352f95acd104c19d9bf60fb77b046";

    $.getJSON(b, function(json1) {
      $(".temperature").html(json1.main.temp + "°C");

      var unitsC = true; // starting off with Celsius
      var currentC = json1.main.temp + "°C";
      var currentF = json1.main.temp * 9 / 5 + 32 + "°F";
      $('.temperature').html(currentC); // set the initial value in the button
      $(".temperature").click(function() {
        if (unitsC) {

        } else {

        unitsC = !unitsC; // invert the flag


      $(".icon").html("<img src='" +[0].icon + ".png' alt='Icon depicting current weather.'>");