Pen Settings



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


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


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.


Auto Save

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.


                <button class="font-style">
  Hover Me

  <!-- If you have time, it would be better to generate this SVG for each button you want the effect on -->
  <svg xmlns="" viewBox="0 0 426 98">
      <mask id="mask">
        <circle class="mask" r="0" fill="#fff" cx="0" cy="50" />

    <g id="toBeRevealed" mask="url(#mask)">
    <linearGradient id="gradient">
        <stop stop-color="#fc0f47" offset="0%" />
        <stop stop-color="#9b040c" offset="100%" />
      <rect width="426" height="98" fill="url(#gradient)" />
      <text x="15" y="81" class="font-style" textAnchor="start" fill="#fff">Hover Me</text>


body {
  height: 100%;

html {
  font-size: 62.5%;

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: #202020;

.font-style {
  font-family: 'Heebo', sans-serif;
  font-size: 9rem;
  font-weight: 700;
  line-height: 1;
  text-stroke: 0.1rem rgba(255,255,255, 0.5);
  -webkit-text-stroke: 0.1rem rgba(255,255,255, 0.5);
  white-space: nowrap;
  /* Unfortunately letter-spacing and text-length don't line up with HTML text across the different browsers... */
  /* you're forced to just leave the letter spacing as is. */

button {
  margin: 0;
  padding: 8px 19px 0 16px;
  border: 0;
  background: none;
  cursor: pointer;
  color: transparent;
  position: relative;
  overflow: hidden;

svg {
  position: absolute;
  top: 0;
  left: 0;
  overflow: hidden;
  border-radius: 1px;
  width: 100%;
  height: 100%;


                const button = document.querySelector('button');
const buttonWidth = button.clientWidth;
const buttonHeight = button.clientHeight;
const buttonStyles = button.getBoundingClientRect();

button.addEventListener('mouseenter', mouseEnter);
button.addEventListener('mouseleave', mouseLeave);

function mouseEnter(e) {
  // Figure out the co-ordinates of the cursor over the button
  // We will trigger the hover animation from that position
  const xPercent = ((e.clientX - buttonStyles.left) / buttonWidth) * 100;
  const yPercent = ((e.clientY - / buttonHeight) * 100;
  // If the cursor is far from the center of the button the hover will be slower since we have more area to fill
  // To fix this we increase the animation speed the further you are from the center of the button
  let transitionMultiplier = xPercent < 50 ? ((xPercent - 50) * -1) / 50 : (xPercent - 50) / 50;
  const speed = 1.3;
  const speedBasedOnCursorPosition = speed - ((speed * 0.65 ) * transitionMultiplier);

  TweenMax.set('.mask', {
    opacity: 1,
    attr: {
      r: 0,
      cx: e.clientX - buttonStyles.left,
      cy: e.clientY -
  new TimelineMax().to('.mask', speedBasedOnCursorPosition, {
    ease: Power4.easeOut,
    attr: { r: buttonWidth * 0.4 }

function mouseLeave() {
  const tl = new TimelineMax()
        .to('.mask', 0.2, {ease: Power1.easeOut, opacity: 0});