Pen Settings

HTML

CSS

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

JavaScript

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

Packages

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.

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

              
                <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
        c-7.042-7.062-16.292-10.588-25.532-10.588c-9.238,0-18.501,3.525-25.551,10.588c-7.044,7.05-10.576,16.294-10.576,25.54
        s3.519,18.489,10.576,25.539c7.05,7.062,16.287,10.575,25.532,10.575c9.259,0,18.509-3.513,25.551-10.575l12.778,12.782
        l12.774,12.771c-14.11,14.086-32.595,21.149-51.104,21.149c-18.482,0-36.974-7.063-51.072-21.149
        C96.682,109.22,89.62,90.731,89.62,72.227c0-18.475,7.062-36.965,21.156-51.065C124.875,7.05,143.366,0,161.849,0
        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
        c-3.524,3.525-5.293,8.148-5.293,12.77c0,4.623,1.769,9.232,5.293,12.757l111.198,111.209h51.09L299.317,5.358z"/>
      <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
        l-5.5,6.303c-3.887-3.619-8.071-6.033-13.616-6.033c-9.308,0-16.049,7.646-16.049,17.172v0.129c0,9.533,6.742,17.316,16.049,17.316
        c5.966,0,9.794-2.441,13.964-6.326l5.495,5.549c-5.067,5.297-10.625,8.629-19.743,8.629C10.561,265.545,0,254.492,0,240.533
         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
        c0-3.5-1.938-5.373-10.981-7.438c-10.355-2.52-16.192-5.566-16.192-14.537v-0.143c0-8.34,6.948-14.104,16.619-14.104
        c7.088,0,12.717,2.146,17.65,6.109l-4.584,6.469c-4.377-3.279-8.768-4.996-13.209-4.996c-5.003,0-7.929,2.543-7.929,5.758v0.145
        c0,3.756,2.222,5.408,11.546,7.627c10.275,2.506,15.635,6.186,15.635,14.268v0.129c0,9.105-7.154,14.525-17.367,14.525
        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
         M267.037,235.719h-9.516v9.527h9.516V235.719z"/>
    </svg>
  </div>
</div>
              
            
!

CSS

              
                // [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);
	}
}
              
            
!

JS

              
                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
enquire
  .register("screen and (max-width: 499px)", function() {
    setViewbox(logoWidthSm, logoHeight);
    setMode('small');
  })
  .register("screen and (min-width: 500px)", function() {
    setViewbox(logoWidthMd, logoHeight);
    setMode('medium');
  })
  .register("screen and (min-width: 700px)", function() {
    setViewbox(logoWidth, logoHeight);
    setMode('large');
  });

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

  var mode = e.target.getAttribute('data-mode');
  setMode(mode);
  
  if (mode == 'small') {
    setViewbox(logoWidthSm, logoHeightSm);
  } else if (mode == 'medium') {
    setViewbox(logoWidthMd, logoHeightMd);
  } else {
    setViewbox(logoWidth, logoHeight);
  }
});
              
            
!
999px

Console