css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation


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.

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 id="background">
<div id="container">
   <div id="city"></div>
   <div id="temperature"></div>
   <div id="results">
      <div id="condition"></div>
      <div id="wind-speed"></div>
      <button id="convert-button">Change units</button>
              mainColor = #8e44ad
offWhite = #ecf0f1
body {
  font-family 'Roboto', sans-serif
  text-align center
  background-color offWhite
h1 {
  color black
#container {
  width 100%
  height 100%
  background-color offWhite
#convert-button {
   padding 10px
   margin 10px
   background-color mainColor
   color offWhite
   border 1px solid mainColor
   transition 0.3s all
   cursor pointer
#convert-button:hover {
   background-color offWhite
   color mainColor
   box-shadow 0em 0em 2em #7f8c8d
   border 1px solid mainColor
#convert-button:focus {
   outline 0px
#convert-button:active {
   box-shadow 0em 0em 0em #7f8c8d
              var lat = "";
var lon = "";
var getPosition = function(position) {
   var url = "https://api.forecast.io/forecast/";
   var key = "67ca482b6a29a27c991ee7c1d81e4485/"; // get your own key
   var units = "imperial"; // imperial by default
   // check and see if browser allows geolocation. Displays console.log for now.
   // TODO: display to user their geolocation status
   if ("geolocation" in navigator) {
      console.log("geolocation works in your browser");
      lat = position.coords.latitude;
      lon = position.coords.longitude;
   } else {
      console.log("geolocation is rip")
var displayWeather = function() {
      url: url + key + lat + "," + lon,
         console.log("The API responded."),
         console.warn("The api broke"),
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................