Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

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


Auto Save

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">
    <div id="city-names"></div>


                body {
  background-color: #0F0923;
  color: #dd3535;
  align-items: center;
  flex-direction: column;
  font-family: 'titleFont';

#city-names {
  font-size: 9em;
  margin: 0.2em 0;
  line-height: 1em;
  font-weight: normal;
  font-family: 'weatherFont';

h2 {
  font-family: 'baseFont';

.container {
  width: 90%;

#city-names span:nth-of-type(3n-1) {
  color: #fefefe ;

#city-names span:nth-of-type(3n-2) {
  color: #36e8ff ;


                //Try the library here
// This function takes a city and a callback
// It returns the weather data of the city
function yahooApiQuery(city, callback) {
  if (!city || !callback) {
    throw new Error('$.YQL(): Parameters may not be undefined');
  const encodedQuery = encodeURIComponent(
    `select * from weather.forecast where woeid in (select woeid from geo.places(1) where text='${city}')`.toLowerCase()
  const url = `${encodedQuery}&format=json&diagnostics=true&`;
  $.getJSON(url, callback);

// This takes a city and a PtypoFont object
// It requests the Yahoo weather API and change the params of the font accodingly
function getValueAndChangeFont(city, font) {
    function(data) {
        thickness: parseInt( * 2,
        slant: parseInt(,

const cities = [
  'San Francisco',

// Creates the prototypo font factory
const ptypoFactory = new Ptypo.default();

// For each cities creates a span element styled with the correct font
cities.forEach(function(city, idx) {
    `<span style="font-family: ${city}WeatherFont">${city}</span> `
  // Creates a font with the same name and call getValueAndChangeFont with the city
  // name and the PtypoFontObject
      function(font) {
        getValueAndChangeFont(city, font);