Streaming live at 10am (PST)

Codepen to Webflow Error

Hi, I’ve been trying to add this loading animation from Codepen onto my site, but I’ve been having some trouble with it, specifically, when I add the HTML portion of my code into my embedded code block, I just get a big block of text instead of the tea icon.

Here are some screenshots of what things look like right now:

Welcome to the community @Elvina_Prasad!

The issue here is that the CodePen you’re referencing has applied the Pug HTML preprocessor so the code won’t process as normal HTML:

image

I went ahead and went through the SVG code and converted it to normal HTML, so give this a try instead:

<svg class="tea" width="37" height="48" viewbox="0 0 37 48" fill="none">
  <path d="M27.0819 17H3.02508C1.91076 17 1.01376 17.9059 1.0485 19.0197C1.15761 22.5177 1.49703 29.7374 2.5 34C4.07125 40.6778 7.18553 44.8868 8.44856 46.3845C8.79051 46.79 9.29799 47 9.82843 47H20.0218C20.639 47 21.2193 46.7159 21.5659 46.2052C22.6765 44.5687 25.2312 40.4282 27.5 34C28.9757 29.8188 29.084 22.4043 29.0441 18.9156C29.0319 17.8436 28.1539 17 27.0819 17Z" stroke="var(--secondary)" stroke-width="2"></path>
  <path d="M29 23.5C29 23.5 34.5 20.5 35.5 25.4999C36.0986 28.4926 34.2033 31.5383 32 32.8713C29.4555 34.4108 28 34 28 34" stroke="var(--secondary)" stroke-width="2"></path>
  <path id="teabag" fill="var(--secondary)" fill-rule="evenodd" clip-rule="evenodd" d="M16 25V17H14V25H12C10.3431 25 9 26.3431 9 28V34C9 35.6569 10.3431 37 12 37H18C19.6569 37 21 35.6569 21 34V28C21 26.3431 19.6569 25 18 25H16ZM11 28C11 27.4477 11.4477 27 12 27H18C18.5523 27 19 27.4477 19 28V34C19 34.5523 18.5523 35 18 35H12C11.4477 35 11 34.5523 11 34V28Z"></path>
  <path id="steamL" d="M17 1C17 1 17 4.5 14 6.5C11 8.5 11 12 11 12" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" stroke="var(--secondary)"></path>
  <path id="steamR" d="M21 6C21 6 21 8.22727 19 9.5C17 10.7727 17 13 17 13" stroke="var(--secondary)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"</path>
</svg>
1 Like

Hi @mikeyevin!

Thank you so much for converting this for me! I really appreciate it!!

So, I tried pasting everything back in and for some reason, the tea animation is still not showing up. I took some more screenshots to show what I mean:

To be completely honest, not sure what I’m doing wrong.

Just like the HTML, the CSS is using its own preprocessor (Stylus), so the syntax needs to be tweaked:

image

I went ahead and converted this for you to standard CSS, so give this a try instead:

<style>
body {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

svg.tea {
  --secondary: #33406F;
  //transform: scale(2);
}

#teabag {
  transform-origin: top center;
  transform: rotate(3deg);
  animation: swing 2s infinite;
}

#steamL {
  stroke-dasharray: 13;
  stroke-dashoffset: 13;
  animation: steamLarge 2s infinite;
}

#steamR {
  stroke-dasharray: 9;
  stroke-dashoffset: 9;
  animation: steamSmall 2s infinite;
}

@keyframes swing {
  50% {
    transform: rotate(-3deg);
  }
}

@keyframes steamLarge {
  0% {
    stroke-dashoffset: 13;
    opacity: .6;
  }

  100% {
    stroke-dashoffset: 39;
    opacity: 0;
  }
}

@keyframes steamSmall {
  10% {
    stroke-dashoffset: 9;
    opacity: .6;
  }

  80% {
    stroke-dashoffset: 27;
    opacity: 0;
  }

  100% {
    stroke-dashoffset: 27;
    opacity: 0;
  }
}
</style>
1 Like

AHA! It works! YOU ARE A LIFESAVER! Thank you so much @mikeyevin!!!

1 Like