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

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


  <div class="container-fluid" align="center">
      <h1>Lokay<span class="yellow">Sun</span></h1>
      <h3>Local Weather. Real Time.</h3>
    <div class="weatherDisplay">
      <div class="icon">
        <img id="icon" style="padding-top: 20px;" src=""/>
      <div class="temp">
        <span id="temp" style="font-size: 6rem"></span>
        <span id="temScale" style="font-size: 3rem">°F</span>
      <div class="location" style="font-size: 2rem">
        <span id="loc"></span>
    <footer align="center">Designed <span class="yellow">&amp;</span> Coded by: Drew Clements</footer>


                @import url(',300,400,500,600,700');

  color: white;
  background-color: #00cdcd;
  font-family: 'Oswald', Helvetica, sans-serif;
  font-size: 16px;

  color: #ffb90f;

  font-size: 4em;
  padding: .25em;
  letter-spacing: -5px;

h3 {
  font-weight: 200;
  letter-spacing: .5em;

@media (max-width: 550px) {
  h3 {
    letter-spacing: .25em;

  padding: 40px;



                var APPID = "1a5840823ced3a26d3087be90dbb4989";
var icon;    
var temp;
var loc;

function sendRequest(url) {
 var xmlhttp = new XMLHttpRequest();
 xmlhttp.onreadystatechange = function() {
  if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
   var data = JSON.parse(xmlhttp.responseText);
   var weather = {};
   weather.icon =[0].icon;
   weather.loc =;
   weather.temp = K2F(data.main.temp);

 };"GET", url, true);

function update(weather) {
 temp.innerHTML = weather.temp;
 loc.innerHTML = weather.loc;
 icon.src = "" + weather.icon +".png";

window.onload = function() {
 icon = document.getElementById("icon");
 temp = document.getElementById("temp");
 loc = document.getElementById("loc");
    var showPosition = function(position){
      updateByGeo(position.coords.latitude, position.coords.longitude);

function updateByGeo(lat, lon) {
  var url ="" +
  "lat=" + lat +
  "&lon=" + lon +
  "&APPID=" + APPID;

function K2F(k){
    return Math.floor(9/5 * (k-273) + 32);

function cToF(celsius) {
  return Math.floor(celsius * 9 / 5 + 32);

function fToC(fahrenheit) {
  return Math.floor((fahrenheit - 32) * 5 / 9);

function toggleScale() {
  if (temScale.innerHTML === "°C") {
    temp.innerHTML = cToF(temp.innerHTML);
    temScale.innerHTML = "°F";
  } else if (temScale.innerHTML === '°F') {
    temp.innerHTML = fToC(temp.innerHTML);
    temScale.innerHTML = "°C";

// toggle the temperature scale
temScale.addEventListener("click", toggleScale);