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 CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

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.

    | Below are 3 inline-block level elements. The buttons toggle their listed styles on each element.
    | Toggle the float and alignment buttons to see how the different properties interact.

      button.button.expanded.secondary.js-toggle-prop(data-prop='vertical-align', data-value='top') vertical-align: top;
      button.button.expanded.secondary.js-toggle-prop(data-prop='vertical-align', data-value='middle') vertical-align: middle;
      button.button.expanded.secondary.js-toggle-prop(data-prop='vertical-align', data-value='bottom') vertical-align: bottom;

      button.button.expanded.secondary.js-toggle-prop(data-prop='float', data-value='left') float: left;
      button.button.expanded.secondary.js-toggle-prop(data-prop='float', data-value='right') float: right;

          | not much
          | a little more here
          | a fair amount more text here
              .wrap {
  max-width: 760px;
  margin: 0 auto;
  padding-left: 2rem;
  padding-right: 2rem;

.button.secondary {
  &.is-active { background-color: skyblue;}

.block {
  background-color: transparentize(skyblue, .9);
  padding: 2rem;
  margin-bottom: 1rem;

.pill {
  border: 1px solid;
  color: skyblue;
  display: inline-block;
  font-weight: bold;
  max-width: 32.5%;
  padding: .25em .5em;
  text-align: center;

.fl--right {
  float: right;

.cf {
  &:after {
    content: '';
    display: table;
  &:after { clear: both;}
              const toggleTargets = document.querySelectorAll('.js-target');
const propTogglers = document.querySelectorAll('.js-toggle-prop');

function propToggler({ toggleElems, targetElems }) {
  const targets = [].slice.call(targetElems);
  const togglers = [].slice.call(toggleElems);
  const activeClassName = 'is-active';

  function init() {
    togglers.map(toggle => {
      toggle.prop = toggle.getAttribute('data-prop');
      toggle.value = toggle.getAttribute('data-value');
      toggle.isActive = false;
    document.body.addEventListener('mouseup', handleClick);
  function handleClick(e) {
    const target = e.target;
    togglers.map(toggle => {
      if (target === toggle) handleToggleClick(toggle);
  function handleToggleClick(toggle) {
    const isActive = toggle.isActive;
    const prop = toggle.prop;
    const value = !toggle.isActive ? toggle.value : '';
    targets.map((el) => el.style[prop] = value );
    toggle.isActive = !isActive;
    if (toggle.isActive) addActiveClass(toggle);
  function deactivateAllByProp(prop) {
    togglers.map(toggle => {
      if (toggle.prop === prop) {
        toggle.isActive = false;
  function addActiveClass(toggle) {
  function removeActiveClass(toggle) {

  toggleElems: propTogglers,
  targetElems: toggleTargets,

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.


Loading ..................