Pen Settings

HTML

CSS

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

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

Behavior

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.

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.

HTML

              
                    <div class="toggles">
      <a href="#" id="standard" class="toggle-editorial button on">Standard Layout</a> | 
      <a href="#" id="toggle-editorial" class="toggle-editorial button ">Editorial Layout #1</a> | 
    <a href="#" id="toggle-editorial-2" class="toggle-editorial button ">Editorial Layout #2</a>
  </div>
<article id="main-content" class="main-content">
  
  <header>
    <h1>Design is communication</h1>
    <h2>And if you can’t explain it, you’re not done designing it yet</h2>
  </header>
  <footer>
    <div class="date-header">Published Wednesday, 16 December, 2015</div>
    <div class="byline">by Jason Pamental</div>
  </footer>
                  
  <figure>
    <img srcset="https://rwt.io/sites/default/files/styles/max_325x325/public/1-bx3abzlwxm0hwlpxver7va.jpeg 325w, https://rwt.io/sites/default/files/styles/max_650x650/public/1-bx3abzlwxm0hwlpxver7va.jpeg 650w, https://rwt.io/sites/default/files/styles/max_1300x1300/public/1-bx3abzlwxm0hwlpxver7va.jpeg 1300w, https://rwt.io/sites/default/files/styles/max_2600x2600/public/1-bx3abzlwxm0hwlpxver7va.jpeg 1600w" sizes="(min-width: 1290px) 1290px, 100vw" class="image" src="https://rwt.io/sites/default/files/styles/max_325x325/public/1-bx3abzlwxm0hwlpxver7va.jpeg" alt="Matchbox with Design Explanation">
    <figcaption>In this project I incorporated my paper into the design, mounting it inside the lid of a matchbox set</figcaption>
  </figure>
  <p class="lede">A while back I wrote an article about one of my most influential experiences studying Graphic Design: the requirement of one of my instructors that we show up for any ‘first crit’ with no fewer than&nbsp;<a href="https://medium.com/@jpamental/30-thumbnails-e45bb445b09e">30 thumbnails</a>. But there was another experience, with another instructor, that perhaps had an even greater impact on me and on the way I guide and teach other designers.</p>

  <p>While <a href="http://www.ric.edu/art/cv/pages/heemong-kim.aspx">Heemong Kim</a>’s requirement centered on the start of any project, <a href="http://www.ric.edu/art/cv/pages/nancy-bockbrader.aspx">Nancy Bockbrader</a>’s signature element came at the finish:&nbsp;every project, no matter how big or small, had to include a paper explaining the ‘why’ behind the design decisions made in the course of the assignment. It could be as short as a paragraph or two, but if you couldn’t explain in clear language the reasoning for your typeface selection, color palette or any other visual language, you just weren’t done.</p>

  <p>I’m not sure, but I may have been one of the only students who actually&nbsp;liked that part.</p>

  <p>This forced clarity. It meant that even if you made up the explanation to fit the project, you still had to sell it. You had to be comfortable with the vocabulary of design, and how to use it convincingly and with rigor.</p>
      
  <figure>
<img srcset="https://rwt.io/sites/default/files/styles/max_325x325/public/1-r3nu-j9j1izupsdbz4rdvq.jpeg 325w, https://rwt.io/sites/default/files/styles/max_650x650/public/1-r3nu-j9j1izupsdbz4rdvq.jpeg 650w, https://rwt.io/sites/default/files/styles/max_1300x1300/public/1-r3nu-j9j1izupsdbz4rdvq.jpeg 1200w" sizes="(min-width: 1290px) 1290px, 100vw" class="image" src="https://rwt.io/sites/default/files/styles/max_325x325/public/1-r3nu-j9j1izupsdbz4rdvq.jpeg" alt="Detail of the matchbox set made of steel, oak &amp; black-and-white photos on acetate">
    <figcaption>Detail of the matchbox set made of steel, oak &amp; black-and-white photos on acetate</figcaption>
  </figure>
  
  <p>It probably helped that I went to school a few years later than most, but I was ready to think, and do so out loud. I found by focusing on the explanation, it made the work stronger. Because when you have to say it out loud (even metaphorically), a weak idea has no place to hide. It becomes very apparent, very quickly, that the reasoning for a typeface choice, or the cultural relevance of a color palette, or the subtle symbolism embedded in a logo might just have been more for your benefit than the imaginary client’s.</p>

  <p>I’ve used this technique in classes I’ve taught, and even with design teams I’ve managed. Not for the client per se, but for our own internal review. This is even more important. When conducting an internal design review it’s critical the designer be able explain why this solution is the best one.</p>

  <p>Without explanation all we can do is evaluate execution, not effectiveness</p>

  <p>There’s an important byproduct of this process: if every designer has to explain their work clearly and convincingly on a regular basis, they’re far more likely to do so with clients. This is critical, because in all but the rarest of cases, our clients aren’t designers. They don’t know what we know, or speak the same language we speak. We must be our own translators, and educate the client along the way. If we can’t bring them along to the view we have created, why should they believe us when we say it’s the right one?</p>

  <p>I’ve brought this practice into the teams I’ve run over the years, and make it part of the daily routine. When we talk about work, we talk about why it’s effective. When a designer works on a project, they present it to the client. If two designers are working, they each present their own. Not only does this provide opportunity to practice this kind of communication, it also gives them the credit they deserve for the work they have done. The solution comes from the team, so the team should have time in front of the client to shine.</p>

  <p>Besides, as <a href="https://twitter.com/monteiro">Mike Monteiro</a> put it so well in <a href="http://abookapart.com/products/design-is-a-job">Design is a Job</a>:&nbsp;if you’re not the one selling it, you didn’t finish designing.</p>
  <p>[ True story: the matchbox set pictured was a project for a class with Nancy, and was included in <a href="http://www.graphis.com/">Graphis Magazine</a>’s <em>Student Design Annual 1997</em>&nbsp;]</p>

  <p class="caption"><em>Text and images &copy;2019 Jason Pamental. All rights reserved. <a href="https://rwt.io/blog/2015/12/design-communication">Originally published on RWT.io</a></em></p>

</article>
              
            
!

CSS

              
                /* Note below that you can find min and max */
/* values for width and weight */
@font-face {
  font-family: 'Univers Next Variable';
  src: url('https://rwt.io/_demo_fonts/monotype/univers/UniversNextVariable.woff2') format('woff2-variations');
  font-display: swap;
  font-stretch: 75% 140%;
  font-style: normal;
  font-weight: 300 900;
}

/* Note below that you can find min and max */
/* values for width and weight */
@font-face {
  font-family: 'Univers Next Variable';
  src: url('https://rwt.io/_demo_fonts/monotype/univers/UniversNextVariable-Italic.woff2') format('woff2-variations');
  font-display: swap;
  font-stretch: 75% 140%;
  font-style: italic;
  font-weight: 300 900;
}

:root {
  /* font stack variables */
  --font-stack-sans-vf: "Univers Next Variable", Helvetica, arial, sans-serif;
  
  /* assign font stacks for headings and text */
  --font-stack-heading: var(--font-stack-sans-vf);
  --font-stack-body: var(--font-stack-sans-vf);

  /* breakpoint variables */
  --bp-small: 25;
  --bp-medium: 45;
  --bp-large: 55;
  --bp-xlarge: 65;
  
  /* color variables */
  
  --gray-dark: #313141;
  --white: #ffffff;

  --text-color: var(--gray-dark);
  --background-color: var(--white);
  
  /* set px value sizes */
  /* initial px value for text */
  --rem-px: 16;

  /* EDIT HERE to set px value sizes */
  --p-size-s-px: 16;
  --p-size-l-px: 20;
  --h1-size-s-px: 40;
  --h1-size-l-px: 72;
  --h2-size-s-px: 28;
  --h2-size-l-px: 48;

  /* set scale values */
  
  /* calcs to create values for the formulas */
  --p-size-min: calc( var(--p-size-s-px) / var(--rem-px) );
  --p-size-max: calc( var(--p-size-l-px) / var(--rem-px) );
  --p-lh-min: 1.3;
  --p-lh-max: 1.6;
  
  /* values to scale across breakpoint range */
  --p-wdth-min: 90;
  --p-wdth-max: 100;
  --p-wght-min: 350;
  --p-wght-max: 400;

  /* default starting scale value */
  --p-wdth: var(--p-wdth-min);
  --p-wght: var(--p-wght-min);

  /* calcs to create values for the formulas */
  --h1-size-min: calc( var(--h1-size-s-px) / var(--rem-px) );
  --h1-size-max: calc( var(--h1-size-l-px) / var(--rem-px) );
  --h1-lh-min: 1.05;
  --h1-lh-max: 1.1;
  
  /* values to scale across breakpoint range */
  --h1-wdth-min: 75;
  --h1-wdth-max: 85;
  --h1-wght-min: 600;
  --h1-wght-max: 700;

  /* default starting scale value */
  --h1-wdth: var(--h1-wdth-min);
  --h1-wght: var(--h1-wght-min);

  /* calcs to create values for the formulas */
  --h2-size-min: calc( var(--h2-size-s-px) / var(--rem-px) );
  --h2-size-max: calc( var(--h2-size-l-px) / var(--rem-px) );
  --h2-lh-min: 1.05;
  --h2-lh-max: 1.1;
  
  /* values to scale across breakpoint range */
  --h2-wdth-min: 85;
  --h2-wdth-max: 100;
  --h2-wght-min: 425;
  --h2-wght-max: 500;

  /* default starting scale value */
  --h2-wdth: var(--h2-wdth-min);
  --h2-wght: var(--h2-wght-min);
}

  html {
    box-sizing: border-box;
  }
  *, *:before, *:after {
    box-sizing: inherit;
  }
  
  
body {
  background-color: var(--background-color);
  color: var(--text-color);
  font-family: var(--font-stack-body);
  margin: 0;
}

h1 {
  font-family: var(--font-stack-heading);
  /* set low-end scale values for smallest screens */
  font-size: calc( var(--h1-size-min) * 1rem);
  line-height: var(--h1-lh-min); 
  /* JS will scale the next two values dynamically */
  font-stretch: calc( var(--h1-wdth) * 1%);
  font-weight: var(--h1-wght);
}
  @media screen and (min-width: 25em) {
    h1 {
      /* use formula to scale from low value to high between breakpoints */
      line-height: calc(( var(--h1-lh-min) * 1em ) + ( var(--h1-lh-max) - var(--h1-lh-min) ) * ((100vw - ( var(--bp-small) * 1em )) / ( var(--bp-xlarge) - var(--bp-small) )));
      font-size: calc(( var(--h1-size-min) * 1em ) + ( var(--h1-size-max) - var(--h1-size-min) ) * ((100vw - ( var(--bp-small) * 1em )) / ( var(--bp-xlarge) - var(--bp-small) ))); 
    } 
  }
  @media screen and (min-width: 65em) {
    h1 {
      /* set high end values to cap scale for largest screens */
      font-size: calc( var(--h1-size-max) * 1em);
      font-stretch: calc( var(--h1-wdth-max) * 1%);
      font-weight: var(--h1-wght-max); 
      line-height: var(--h1-lh-max); 
    }
  }

h2 {
  font-family: var(--font-stack-heading);
  /* set low-end scale values for smallest screens */
  font-size: calc( var(--h2-size-min) * 1rem);
  line-height: var(--h2-lh-min); 
  /* JS will scale the next two values dynamically */
  font-stretch: calc( var(--h2-wdth) * 1%);
  font-weight: var(--h2-wght);
}
  @media screen and (min-width: 25em) {
    h2 {
      /* use formula to scale from low value to high between breakpoints */
      line-height: calc(( var(--h2-lh-min) * 1em ) + ( var(--h2-lh-max) - var(--h2-lh-min) ) * ((100vw - ( var(--bp-small) * 1em )) / ( var(--bp-xlarge) - var(--bp-small) )));
      font-size: calc(( var(--h2-size-min) * 1em ) + ( var(--h2-size-max) - var(--h2-size-min) ) * ((100vw - ( var(--bp-small) * 1em )) / ( var(--bp-xlarge) - var(--bp-small) ))); 
    } 
  }
  @media screen and (min-width: 65em) {
    h2 {
      /* set high end values to cap scale for largest screens */
      font-size: calc( var(--h2-size-max) * 1em);
      font-stretch: calc( var(--h2-wdth-max) * 1%);
      font-weight: var(--h2-wght-max);
      line-height: var(--h2-lh-max);
    } 
  }


p {
  font-family: var(--font-stack-body);
  /* set low-end scale values for smallest screens */
  font-size: calc( var(--p-size-min) * 1rem);
  line-height: var(--p-lh-min); 
  /* JS will scale the next two values dynamically */
  font-stretch: calc( var(--p-wdth) * 1%);
  font-weight: var(--p-wght);
}
  @media screen and (min-width: 25em) {
    p {
      /* use formula to scale from low value to high between breakpoints */
      line-height: calc(( var(--p-lh-min) * 1em ) + ( var(--p-lh-max) - var(--p-lh-min) ) * ((100vw - ( var(--bp-small) * 1em )) / ( var(--bp-xlarge) - var(--bp-small) )));
      font-size: calc(( var(--p-size-min) * 1em ) + ( var(--p-size-max) - var(--p-size-min) ) * ((100vw - ( var(--bp-small) * 1em )) / ( var(--bp-xlarge) - var(--bp-small) )));
    }
  }
  @media (min-width: 65em) {
    p {
      /* set high end values to cap scale for largest screens */
      font-size: calc( var(--p-size-max) * 1em);
      font-stretch: calc( var(--p-wdth-max) * 1%);
      font-weight: var(--p-wght-max);
      line-height: var(--p-lh-max);
    }
  }

* + p {
  margin-top: 1em; 
} 
    



/* New styles for layout examples */

p {
  margin: 0 auto;
  max-width: 96vw;
}
@media screen and (min-width: 46em) {
  p {
    max-width: 40em;
  }
}
* + p {
  margin-top: 1em; 
} 
 
h1 {
  margin: 0.5em 0;
}

h2 {
  margin: 0 0 0.5em;
}

figure {
  margin: 0 auto;
}

* + figure {
  margin-top: 1em;
}

figcaption {
  font-size: 0.925em;
  margin: 0 0.25em;
}

img {
  height: auto;
  max-width: 100%;
  width: 100%;
}

.main-content {
  margin-bottom: 2em;
}

article > header {
  margin: 0 auto;
  max-width: 98vw;
}

article > footer {
  margin: 0 auto;
  max-width: 98vw;
}

article > header h2 {
  font-style: italic;
}

.lede {
  font-size: 1.25em;
  font-weight: 325;
  max-width: 96vw;
}

@media screen and (min-width: 64em) {
  .lede {
    font-size: 1.5em;
    max-width: 40em;
  }
}

.caption {
  font-size: 0.925em;
  max-width: 98vw;
}
@media screen and (min-width: 35em) {
  .caption {
    max-width: calc(40 * 1.25rem);
  }
}

/* Editorial 1 */

.editorial > header {
  margin-left: 1vw;
  max-width: 40rem;
}
@media screen and (min-width: 65em) {
  .editorial > header {
    display: grid;
    grid-template-columns: calc((40 * 1.25rem) + 1rem) auto;
    align-items: end;
    max-width: none;
  }
}

.editorial h1 {
  --h1-size-max: 9;
  --h1-wdth: 75;
  --h1-wdth-max: 75;
  --h1-wght: 300;
  --h1-wght-max: 300;
  letter-spacing: -0.05em;
  line-height: 1;
  margin-bottom: 0;
}

.editorial > header h2 {
  --h2-size-min: 1.5;
  --h2-size-max: 2.25;
  --h2-wght: 300;
  --h2-wght-max: 300;
  margin-top: 0.5rem;
  margin-bottom: 1.5rem;
}

.editorial > footer {
  margin-left: 1vw;
  max-width: 40rem;
}
@media screen and (min-width: 35em) {
  .editorial > footer {
    max-width: calc(40 * 1.25rem);
  }
}


.editorial p {
  margin-left: 1vw;
}
@media screen and (min-width: 35em) {
  .editorial p {
    margin-left: 2vw;
  }
}

.editorial figure {

}
  @media screen and (min-width: 60em) {
    .editorial figure {
      clear: right;
      float: right;
      max-width: calc(100vw - (40 * 1.25rem));
      padding-left: 2rem;
    }
  }

/* Editorial 2 */

.editorial2 > header {
  margin-left: 1vw;
  max-width: 40rem;
}
@media screen and (min-width: 55em) {
  .editorial2 > header {
    float: left;
    margin-left: 0;
    margin-right: 1vw;
    text-align: right;
    transform: rotate(180deg);
    writing-mode: vertical-rl;
  }
}

.editorial2 h1 {
  --h1-size-max: 9;
  --h1-wdth: 75;
  --h1-wdth-max: 75;
  --h1-wght: 300;
  --h1-wght-max: 300;
  height: 6em;
  letter-spacing: -0.05em;
  line-height: 1;
  margin-bottom: 0;
}
@media screen and (min-width: 55em) {
  .editorial2 h1 {
    margin-bottom: 1rem;
  }
}

.editorial2 > header h2 {
  --h2-size-min: 1.5;
  --h2-size-max: 1.75;
  --h2-wght: 300;
  --h2-wght-max: 300;
  --h2-wdth: 90;
  --h2-wdth-max: 95;
  margin-top: 0.5rem;
  margin-bottom: 1.5rem;
}
@media screen and (min-width: 55em) {
  .editorial2 > header h2 {
    margin-bottom: 1rem;
  }
}

.editorial2 > footer {
  
}
@media screen and (min-width: 55em) {
  .editorial2 > footer {
    float: right;
    margin-right: 1vw;
  }
}

.editorial2 > footer > * {
  display: inline-block;
}

@media screen and (min-width: 55em) {
  .editorial2 > footer + figure {
    margin-left: 23.75rem;
    padding-left: 0;
  }
}

.editorial2 .lede:first-line {
  font-stretch: 130%;
  font-variant-caps: all-small-caps;
  font-weight: 650;
}
@media screen and (min-width: 55em) {
  .editorial2 .lede {
    margin-left: 23.75rem;
    padding-left: 0;
  }
}

@media screen and (min-width: 55em) {
  .editorial2 p {
    margin-left: 23.5rem;
    padding-left: 0;
  }
}


@media screen and (min-width: 35em) {
  .editorial2 p + figure {
    float: left;
    margin-left: 0;
    margin-right: 2vw;
    max-width: 49vw;
    padding-left: 0;
  }
}
@media screen and (min-width: 55em) {
  .editorial2 p + figure {
    float: left;
    margin-left: 0;
    max-width: 21.5em;
    padding-left: 0;
  }
}

.toggles {
  margin: 0.5rem;
}

.toggles .on {
  font-weight: bold;
}
              
            
!

JS

              
                // Class switching for layout control
if (!'classList' in document.createElement('span')) {
  document.getElementById('c-unsupported').classList.remove('hidden');
  document.getElementById('execute').setAttribute('disabled', 'disabled');
} else {
  if (document.getElementById('standard')) {
    document.getElementById('standard').addEventListener('click', function(e) {
      document.getElementById('main-content').classList.remove('editorial');
      document.getElementById('main-content').classList.remove('editorial2');
      document.getElementById('standard').classList.add('on');
      document.getElementById('toggle-editorial').classList.remove('on');
      document.getElementById('toggle-editorial-2').classList.remove('on');
      e.preventDefault();
    });

  }
  if (document.getElementById('toggle-editorial')) {
    document.getElementById('toggle-editorial').addEventListener('click', function(e) {
      document.getElementById('main-content').classList.add('editorial');
      document.getElementById('main-content').classList.remove('editorial2');
      document.getElementById('standard').classList.remove('on');
      document.getElementById('toggle-editorial').classList.add('on');
      document.getElementById('toggle-editorial-2').classList.remove('on');
      e.preventDefault();
    });

  }
  if (document.getElementById('toggle-editorial-2')) {
    document.getElementById('toggle-editorial-2').addEventListener('click', function(e) {
      document.getElementById('main-content').classList.add('editorial2');
      document.getElementById('main-content').classList.remove('editorial');
      document.getElementById('standard').classList.remove('on');
      document.getElementById('toggle-editorial').classList.remove('on');
      document.getElementById('toggle-editorial-2').classList.add('on');
      e.preventDefault();
    });

  }
}

// JS for resizing font width and weight
function variableResize() {

  // get the computed styles into an object
  let bodyStyles = window.getComputedStyle(document.body);	
	// set up a place to save new values back 
  let root = document.documentElement;
	
	// Minimum and Maximum viewport size - must be unitless em values
	const maxWindowSize = bodyStyles.getPropertyValue('--bp-xlarge') * 16;
	const minWindowSize = bodyStyles.getPropertyValue('--bp-small') * 16;
	
	// Get current viewport size
	const windowWidth = window.innerWidth
	
  // Scale elements and min/max values
  const pWidthVar = '--p-wdth';
	const pMinFontWidth = bodyStyles.getPropertyValue('--p-wdth-min');
	const pMaxFontWidth = bodyStyles.getPropertyValue('--p-wdth-max');
	scale(pWidthVar, pMinFontWidth, pMaxFontWidth);

  const pWeightVar = '--p-wght';
	const pMinFontWeight = bodyStyles.getPropertyValue('--p-wght-min');
	const pMaxFontWeight = bodyStyles.getPropertyValue('--p-wght-max');
	scale(pWeightVar, pMinFontWeight, pMaxFontWeight);
	
  const h1WidthVar = '--h1-wdth';
	const h1MinFontWidth = bodyStyles.getPropertyValue('--h1-wdth-min');
	const h1MaxFontWidth = bodyStyles.getPropertyValue('--h1-wdth-max');
	scale(h1WidthVar, h1MinFontWidth, h1MaxFontWidth);

  const h1WeightVar = '--h1-wght';
	const h1MinFontWeight = bodyStyles.getPropertyValue('--h1-wght-min');
	const h1MaxFontWeight = bodyStyles.getPropertyValue('--h1-wght-max');
	scale(h1WeightVar, h1MinFontWeight, h1MaxFontWeight);
	
  const h2WidthVar = '--h2-wdth';
	const h2MinFontWidth = bodyStyles.getPropertyValue('--h2-wdth-min');
	const h2MaxFontWidth = bodyStyles.getPropertyValue('--h2-wdth-max');
	scale(h2WidthVar, h2MinFontWidth, h2MaxFontWidth);

  const h2WeightVar = '--h2-wght';
	const h2MinFontWeight = bodyStyles.getPropertyValue('--h2-wght-min');
	const h2MaxFontWeight = bodyStyles.getPropertyValue('--h2-wght-max');
	scale(h2WeightVar, h2MinFontWeight, h2MaxFontWeight);
	
	function scale(varName, minValue, maxValue) {
		// Make sure min/max are numbers
		minValue = minValue * 1;
		maxValue = maxValue * 1;

		//Scale within a range
		const percent = (windowWidth - minWindowSize) / (maxWindowSize - minWindowSize);
		if (maxValue < minValue) {
			var valueScale = minValue - (percent * (minValue - maxValue));
		} else {
			var valueScale = (percent * (maxValue - minValue)) + minValue;
		}
	  
		// Get the new font width
		const newValue = windowWidth > maxWindowSize
		   ? maxValue 
		   : windowWidth < minWindowSize 
				? minValue 
				: valueScale;
	   
		// Set my CSS Custom Property for width to update.
		root.style.setProperty(varName, newValue);
	}
}

window.addEventListener("load", variableResize);
window.addEventListener("resize", variableResize);

              
            
!
999px

Console