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.

            
              .box
  h1.intro Fork me on GitHub
    small *animated* corner style generator

  form#corner-opts
    h2 options:
    dl
      dt
        label(for="opts_pos") position
      dd
        table
          tr
            td
              label
                input(type="radio", name="opts_pos", value="+-")
                | top-left
            td
              label
                input(type="radio", name="opts_pos", value="++", checked)
                | top-right
          tr
            td
              label
                input(type="radio", name="opts_pos", value="--")
                | bottom-left
            td
              label
                input(type="radio", name="opts_pos", value="-+")
                | bottom-right

      dt
        label(for="color") color
        small  /cat/
      dd
        input#color(type="color", name="color", value="#ffffff", required)
      dt
        label(for="fill") fill color
        small  /background-color/
      dd
        input#fill(type="color", name="fill", value="#000000", required)
      dt
        label(for="url") url
        small  /link/
      dd
        input#url(type="url", name="url", value="###", required)
      dt
        label(for="size") size
        small  /px/
      dd
        input#size(type="number", name="size", min="0", step="5", value="80", required)
      dt
        label(for="animation") animation
      dd
        input#animation(type="checkbox", name="animation", checked)
      dt
        label(for="transparent") transparent
        small  /mix-blend-mode/
      dd
        select#transparent
          optgroup(label="disable")
            option(label="no", value="")
          optgroup(label="enable")
            each i in ['normal', 'multiply', 'screen', 'overlay', 'darken', 'lighten', 'color-dodge', 'color-burn', 'hard-light', 'soft-light', 'difference', 'exclusion', 'hue', 'saturation', 'color', 'luminosity']
              option(label=i, value=i, selected=( i === 'darken' ))

    hr

    .text-center
      input(type="reset")


  textarea#textarea(cols="50", rows="10")
  .text-right
    button.btn(type="button", data-clipboard-target="#textarea") copy

#apply

script#corner-tpl(type="text/template")
  a.github-corner(href="${url}", title="Fork me on GitHub")
    svg(width="${size}", height="${size}", viewbox="0 0 250 250")
      title Fork me on GitHub
      path(d="M0 0h250v250")
      path.octo-arm(d="M127.4 110c-14.6-9.2-9.4-19.5-9.4-19.5 3-7 1.5-11 1.5-11-1-6.2 3-2 3-2 4 4.7 2 11 2 11-2.2 10.4 5 14.8 9 16.2", fill="currentColor", style="transform-origin:130px 110px")
      path.octo-body(d="M113.2 114.3s3.6 1.6 4.7.6l15-13.7c3-2.4 6-3 8.2-2.7-8-11.2-14-25 3-41 4.7-4.4 10.6-6.4 16.2-6.4.6-1.6 3.6-7.3 11.8-10.7 0 0 4.5 2.7 6.8 16.5 4.3 2.7 8.3 6 12 9.8 3.3 3.5 6.7 8 8.6 12.3 14 3 16.8 8 16.8 8-3.4 8-9.4 11-11.4 11 0 5.8-2.3 11-7.5 15.5-16.4 16-30 9-40 .2 0 3-1 7-5.2 11l-13.3 11c-1 1 .5 5.3.8 5z", fill="currentColor")

    style.
      .github-corner svg {
        position: absolute;
        ${dirX}: 0;
        ${dirY}: 0;
        ${trans}
        ${mixBlendMode}
        color: ${color};
        fill: ${fill};
      }
      ${animation}

blockquote.info
  | inspired from <a href="http://tholman.com/github-corners/">GitHub Corners</a>, and <a href="https://github.com/tholman/github-corners/issues/5#issue-116228491">issue</a>
            
          
!
            
              textarea {
  display: block;
  width: 100%;
  margin-top: 2rem;
}

dl {
  margin-left: 2rem;
  margin-bottom: 1.5rem;
}

dt {
  padding-top: .5rem;

  label {
    font-weight: 900;
  }
}

.text-center {text-align: center; }
.text-right {text-align: right; }

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  padding-top: 1px;
  padding-bottom: 5rem;
  background-image: linear-gradient(rgba(#0cc,.5), #fff 10%);
  color: #333;
}

.box {
  max-width: 30rem;
  margin: 0 auto;
}

.intro {
  width: 80%;
  padding-bottom: 1rem;
  margin: .5em auto 1em;
  text-transform: capitalize;
  border-bottom: 1px dashed #999;
  text-align: center;

  small {
    display: block;
    text-transform: none;
  }
}

small {
  opacity: .6;
  font-style: italic;
}

.info {
  position: absolute;
  bottom: 0;
  right: 0;
  margin: 1em;
  font-size: .9em;
  font-style: italic;
  font-family: serif;
  text-align: right;
  color: #999;

  a {
    color: inherit;
  }
}

            
          
!
            
              /* globals Clipboard */

let corner = {
  tpl: document.getElementById('corner-tpl').textContent.trim(),
  textarea: document.getElementById('textarea'),
  target: document.getElementById('apply')
};

let animationStyle = `
  .github-corner:hover .octo-arm {
    animation: octocat-wave .56s;
  }
  @keyframes octocat-wave {
    0%, 100% {transform: rotate(0); }
    20%, 60% {transform: rotate(-20deg); }
    40%, 80% {transform: rotate(10deg); }
  }`;

corner.form = document.getElementById('corner-opts');

let update = function () {
  let color = corner.form.color.value;
  let fill = corner.form.fill.value;
  let transparent = corner.form.transparent.value;
  let _animationStyle = corner.form.animation.checked ? animationStyle : '';
  let size = corner.form.size.value;
  let url = corner.form.url.value;

  let [ay, ax] = [].filter.call(corner.form.opts_pos, i => i.checked)[0].value
    .split('').map(i => i === '+' ? 1 : -1);

  let trans = (ay === 1 && ax === 1) ? '' : `transform: scale(${ax},${ay});`;

  let dirX = ax > 0 ? 'right' : 'left';
  let dirY = ay > 0 ? 'top' : 'bottom';

  if (transparent !== '') {
    transparent = `mix-blend-mode:${transparent};`;
  }

  let _tpl =
    corner.tpl

      // replace
      .replace(/\${url}/, url)
      .replace(/\${size}/g, size)
      .replace(/\${fill}/, fill)
      .replace(/\${color}/, color)
      .replace(/\${trans}/, trans)
      .replace(/\${dirX}/, dirX)
      .replace(/\${dirY}/, dirY)
      .replace(/\${mixBlendMode}/, transparent)
      .replace(/\${animation}/, _animationStyle)

      // minify
      .replace(/\s*([:{}; ])\s*/g, '$1')
      .replace(/>\s+?</g, '><');

  corner.target.innerHTML = corner.textarea.value = _tpl;
};

// init
(function () {
  update();

  // bind events
  new Clipboard('.btn');
  corner.form.addEventListener('input', update);
  corner.form.addEventListener('change', update);
  corner.form.addEventListener('reset', function () {
    setTimeout(update, 0);
  });
})();

            
          
!
999px
Loading ..................

Console