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.


<div class="container flow-text">
  <div class="row">
    <div class="col s12 m6 offset-m3">
      <div class="card blue-grey lighten-1">
        <div class="card-content blue-grey-text text-lighten-5 center-align">
          <div id="latLong">LOCATION: </div>
          <div id="currentWeather">CONDITIONS: </div>
          <div id="icon"><canvas id="icon1" width="200" height="200"></canvas></div>
          <div id="temperature"><span id="tempText"></span><span id="tempUnits">F</span></div>
            <a class="waves-effect waves-light btn blue-grey lighten-4 blue-grey-text text-darken-2" id="FCButton">Switch C/F</a>
          <div class="divider"></div>
          <div class="center-align">
            <a class="waves-effect waves-light btn blue-grey lighten-4 blue-grey-text text-darken-2 activator">credits</a>
        <div class="card-reveal blue-grey darken-3 blue-grey-text text-lighten-5">
          <span class="card-title">CREDITS<i class="material-icons right">close</i></span></span>
          <p>By Andy Bonner, 2016</p>
          <p>for <a href="">FreeCodeCamp</a></p>
          <p>Weather data is provided by the <a href=""></a> API, and the icons by their <a href="">"Skycons."</a> Layout and DOM manipulation use <a href="">Materialize</a>.


                body {
  background-attachment: fixed;
  background-repeat: no-repeat;
  background: blue;
  /* For browsers that do not support gradients */
  background: -webkit-linear-gradient(#78909c, #263238) fixed;
  /* For Safari 5.1 to 6.0 */
  background: -o-linear-gradient(#78909c, #263238) fixed;
  /* For Opera 11.1 to 12.0 */
  background: -moz-linear-gradient(#78909c, #263238) fixed;
  /* For Firefox 3.6 to 15 */
  background: linear-gradient(#78909c, #263238) fixed;
  /* Standard syntax */

.container {
  font-weight: bold;

.btn {
  margin: 4%;


                function getLocalWeather() {
  var lat, long;
  if (navigator.geolocation) {
    navigator.geolocation.getCurrentPosition(success, error, geoOptions);
  } else {
    alert("Geolocation services are not supported by your web browser.");

  function success(position) {
    lat = position.coords.latitude.toFixed(5);
    long = position.coords.longitude.toFixed(5);
    getWeather(lat, long);
    $("#latLong").append(lat + "°, " + long + "°");

  function error(error) {
    alert("This app only works over a secure connection. Please add 'https://' to the beginning of the URL (i.e. ''). Error code and message: " + error.code + ": " + error.message);

  var geoOptions = {
    enableHighAccuracy: true,
    maximumAge: 30000,
    timeout: 27000

function getWeather(latitude, longitude) {
  $.getJSON("" + latitude + "," + longitude + "?callback=?", function(data) {
    var conditions = data.currently.summary;
    var tempF = data.currently.temperature;
    var tempC = (tempF - 32) / 1.8
    var icon = data.currently.icon;
    var skycons = new Skycons({"color": "#f3e5f5"}); //this line generates the set of Skycons, and also changes the default color to a hint of purple
    skycons.set("icon1", icon); //this first points to the <canvas> element with ID "icon1," and the sets the var icon above to it; //and the animation starts!
    $("#tempText").text("TEMP: " + Math.round(tempF) + "°");
    $("#FCButton").click(function() {
      if ($("#tempUnits").text() === "F") {
        $("#tempText").text("TEMP: " + Math.round(tempC) + "°");
      } else {
        $("#tempText").text("TEMP: " + Math.round(tempF) + "°");