cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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.

  <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 https://app.prototypo.io
// 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 = `https://query.yahooapis.com/v1/public/yql?q=${encodedQuery}&format=json&diagnostics=true&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback=?`;
  $.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(data.query.results.channel.item.condition.temp) * 2,
        slant: parseInt(data.query.results.channel.wind.speed),

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);
🕑 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 ..................