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.

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.

              <button type="button" id="large" class="btn btn-default btn-sm" data-mode="large">Large</button>
<button type="button" id="large" class="btn btn-default btn-sm" data-mode="medium">Medium</button>
<button type="button" id="small" class="btn btn-default btn-sm" data-mode="small">Small</button>

<div class="header">
  <div class="logo">
    <!-- 3kb SVG -->
    <svg viewBox="0 0 525.672 265.545">
      <path id="Mark" fill="#FFFFFF" d="M212.952,21.162l120.943,120.932h-51.106c0,0-88.332-88.342-95.39-95.392
        C180.357,0,198.842,7.05,212.952,21.162 M299.317,5.358c-3.524-3.537-8.148-5.292-12.769-5.292c-4.637,0-9.247,1.755-12.785,5.292
      <path id="Logotype" fill="#FFFFFF" d="M0,240.533v-0.156c0-13.828,10.354-25.164,25.081-25.164c8.967,0,14.396,3.139,19.057,7.594
         M84.204,215.705h7.928l21.401,49.014h-9.025l-4.94-11.752H76.56l-5.002,11.752h-8.761L84.204,215.705z M96.437,245.4l-8.418-19.471
        L79.691,245.4H96.437z M133.043,257.617l5.132-6.121c4.662,4.041,9.322,6.34,15.377,6.34c5.274,0,8.605-2.43,8.605-6.121v-0.129
        C145.897,265.398,138.878,262.832,133.043,257.617 M199.938,216.053h36.082v7.643h-27.527v12.656h24.39v7.643h-24.39v13.076h27.87
        v7.648h-36.425V216.053z M290.277,216.053h9.116l14.797,23.021l14.811-23.021h9.103v48.666h-8.545v-34.914L314.19,252.76h-0.283
        l-15.223-22.789v34.748h-8.407V216.053z M382.906,215.705h7.928l21.409,49.014h-9.04l-4.931-11.752H375.25l-4.983,11.752h-8.769
        L382.906,215.705z M395.135,245.4l-8.407-19.471l-8.34,19.471H395.135z M440.353,223.98h-15.431v-7.928h39.497v7.928h-15.441v40.738
        h-8.625V223.98z M489.248,216.053h36.088v7.643h-27.538v12.656h24.403v7.643h-24.403v13.076h27.874v7.648h-36.424V216.053z
              // [mode] attribute selection for demo purposes
// use media queries in production

.header {
  background: #000;
  height: 40px;
  &[mode='medium'] {
    height: 80px;
  &[mode='large'] {
    height: 120px;

.logo {
  height: 20px;
  width: 50px;
  [mode='medium'] & {
    height: 40px;
    width: 259px;
  [mode='large'] & {
    height: 70px;
    width: 139px;

#Logotype {
	[mode='small'] & {
		opacity: 0;

	[mode='medium'] & {
		transform: scale(2.42) translate(0, -207px);

	[mode='large'] & {
		transform: scale(1);

#Mark {
	[mode='small'] & {
		transform: translate(-89px);

	[mode='medium'] & {
		transform: translate(1266px);
	[mode='large'] & {
		transform: translate(0);
              var header     = document.querySelector('.header');
var logoSVG    = document.querySelector('.logo svg');
var viewbox    = logoSVG.getBBox();
var logoWidth  = Math.floor(viewbox.width * 1000) / 1000;
var logoHeight = Math.floor(viewbox.height * 1000) / 1000;

// values from Illustrator's info panel
var logoWidthMd  = 1702;
var logoHeightMd = 145;
var logoWidthSm  = 347;
var logoHeightSm = 145;

// setMode for demo purposes, use media queries in production
var setMode = function(mode) {
  header.setAttribute('mode', mode);

// setViewbox for matching viewBox to new size of paths
var setViewbox = function(w, h) {
  logoSVG.setAttribute('viewBox', '0 0 ' + w + ' ' + h);

// update logo size when crossing breakpoints
  .register("screen and (max-width: 499px)", function() {
    setViewbox(logoWidthSm, logoHeight);
  .register("screen and (min-width: 500px)", function() {
    setViewbox(logoWidthMd, logoHeight);
  .register("screen and (min-width: 700px)", function() {
    setViewbox(logoWidth, logoHeight);

// ==============================
// boilerplate demo code...
// ==============================
document.addEventListener('click', function(e) {
  if (e.target.type !== 'button') return;

  var mode = e.target.getAttribute('data-mode');
  if (mode == 'small') {
    setViewbox(logoWidthSm, logoHeightSm);
  } else if (mode == 'medium') {
    setViewbox(logoWidthMd, logoHeightMd);
  } else {
    setViewbox(logoWidth, logoHeight);
🕑 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.