How to Add an Animated SVG Logo to WordPress, Shopify or Webflow
Your SVG logo animates when opened on its own but sits still on your site? Here is how to choose the right embed method and install it on WordPress, Shopify, Webflow or Squarespace.
A common problem: the animated logo plays perfectly when you open the file in a browser, then you upload it to your site's logo field and it freezes or never appears.
The cause is usually how the file is embedded, not the animation. This guide covers the three embed methods, the steps for each platform, and the checks to run before you call it done.
Website builders change their settings often, so menu names may differ slightly on your plan or theme.
Pick your embed method first
1. Inline SVG (best choice). You paste the SVG code directly into the page. It is part of the page, so its CSS runs normally, and you can size it with your site's CSS. The trade-off is that its styles are global, which can cause the clashes covered below.
2. Object tag (good fallback). You upload the file and load it with an object tag whose type is image/svg+xml. The SVG runs as its own small document, so its styles stay separate from your site. One catch: the object can swallow clicks, so a logo that links home may stop working. Adding this rule to the object fixes it:
pointer-events: none;
3. Image tag or logo upload field (least reliable). Most theme logo fields output an image tag. Scripts inside the SVG never run this way. CSS animation inside the file may play in some browsers, but there are WebKit bug reports of it sticking on the first frame in Safari. Only use this method if you have tested it on a real iPhone and a Mac. CSS background images have the same limits.
Rule of thumb: use inline if your platform lets you edit the header, the object tag if you can add HTML but want the file kept separate, and the logo field only as a last resort.
Prepare the file before pasting
Do these once, and every platform below gets easier.
- Check for a viewBox. Open the SVG in a text editor and look for viewBox in the opening svg tag. Without it, the logo will not scale properly.
- Convert live text to outlines. Text that relies on a font can display wrongly if that font is missing. Outline it in your vector editor first.
- Give the svg element its own class, such as lm-logo. The CSS below depends on it.
- Rename generic classes. Illustrator exports often use names like .cls-1 or .st0. Once inlined, styles are global, so two SVGs using .cls-1 will overwrite each other. Find and replace them with something unique, such as .lm-a and .lm-b.
- Make IDs unique. Gradients, masks and clip paths are referenced by ID, so a duplicate ID can make part of the logo vanish.
- Remove any script tags. A logo doesn't need them, and many platforms strip them anyway.
- Add an accessible name. On the svg element, add role="img" and aria-label="Your Company home".
- Set a size. This keeps the logo from collapsing or filling the header:
.lm-logo { display: block; width: 160px; height: auto; max-width: 100%; }
- Add a reduced-motion rule. Some visitors ask their devices to limit motion:
@media (prefers-reduced-motion: reduce) { .lm-logo, .lm-logo * { animation: none !important; } }
That rule only works if the logo's normal CSS is its finished, visible state, with the hidden starting point set only in the keyframes (the from step). If your default CSS hides the logo and the animation reveals it, reduced-motion visitors get a blank header. Writing it this way also means the logo still shows if the animation fails to run.
WordPress
WordPress blocks SVG uploads by default, but pasting inline code avoids the upload entirely.
Block themes (Site Editor):
- Go to Appearance, then Editor, and open the Header template part.
- Add a Custom HTML block next to the Site Logo block.
- Paste your SVG code and wrap it in a link to your homepage.
- Save, check the live site, then remove the Site Logo block.
Classic themes and header builders:
- See whether your theme's header builder has an HTML element. Many do. If so, paste the code there.
- If not, use a child theme and put the code in header.php where the logo is output. Editing the parent theme directly means an update can erase your work.
WordPress gotchas:
- Pasting raw SVG requires the unfiltered_html capability, which normally means an administrator. On multisite it is limited to super admins. Other roles may see the code stripped when they save.
- SVG upload and sanitizing plugins can remove style blocks or animation. If you use one, confirm the keyframes are still there afterward.
- Optimization and minify plugins can alter inline code. If the animation breaks, turn them off temporarily, purge the cache and test again.
Shopify
Back up first: in Online Store, then Themes, duplicate your live theme and work on the copy.
- Open the copy and choose Edit code.
- Under Snippets, add a new snippet called animated-logo and paste in your SVG code.
- Find the logo markup. In many themes it is in sections/header.liquid, but file names vary. Searching the theme for settings.logo usually finds it.
- Inside the existing link to your homepage, replace the logo image markup with:
{% render 'animated-logo' %}
- Some themes output the logo more than once, so check for a second instance, such as a mobile or sticky version.
- Preview the copy, then publish it.
Custom code may not carry over when you update your theme, so recheck the logo after any update.
Webflow
- In the Designer, open your Navbar and select the Brand link.
- Remove the Image element inside it.
- Add a Code Embed element in its place and paste your SVG code.
- Publish and test on the live site, since the Designer canvas may not show the animation accurately.
Check your plan's custom code access and the Code Embed character limit. Complex logo exports can be very long, so simplify the paths or use the object tag method if yours won't fit. Avoid Webflow's Image element here, because it brings back the image tag limits above.
Squarespace
Squarespace is the trickiest of the four. Guides disagree on whether its logo field accepts SVG, so try it on your own site rather than trusting a blanket answer.
For a logo inside a page section, such as a hero, add a Code Block, paste the SVG code and save. Check that your plan includes code blocks.
For the site header, you generally can't drop a Code Block in. The usual workaround is to upload the SVG as a custom file in the Custom CSS panel and set it as a background image. On many 7.1 sites the CSS looks like this, but use your browser's inspector to confirm the class name:
.header-title-logo img { opacity: 0; } .header-title-logo a { background: url(YOUR-FILE-ADDRESS) left center / contain no-repeat; }
Keep a normal logo uploaded underneath so the link and layout still work. Because this is a background image, the Safari caveat applies, so test it on an Apple device.
Avoid these header mistakes
- Duplicate logos. Many themes render separate desktop and mobile headers. If a gradient is defined in the copy that's hidden with display: none, the visible copy can lose its color. Give each copy its own IDs.
- Replays you didn't plan for. A CSS animation restarts when its element goes from display: none back to visible, so opening a menu or triggering a sticky header can replay it.
- Long or looping header animations. The logo plays on every page load. Aim for about 1 to 2.5 seconds, play it once, and save loops for loading screens.
- Layout jumps. Set the size in CSS so the header doesn't shift as the page loads.
- Lost home link. Keep the logo inside the theme's homepage link.
- Over-eager SVG optimizers. They can merge shapes, rename IDs or remove styles, so re-test after running one.
Final test checklist
Test the live, published page in a private window after clearing any site cache.
- [ ] Plays in Chrome, Firefox and Safari
- [ ] Plays on a real iPhone and a real Android phone
- [ ] Mobile header and sticky header both look right
- [ ] Clicking the logo goes to the homepage
- [ ] Finished logo stays visible after the animation ends
- [ ] With reduced motion turned on in your device settings, the full logo appears with no animation
- [ ] No sideways scrolling or header jump on a narrow screen
- [ ] Other SVGs and icons on the page still look correct
- [ ] A screen reader announces the logo's name
If the logo still won't animate, open the SVG file directly in a browser. If it plays there, the embed method is the problem, so move one step up the list: logo field to object tag, or object tag to inline. If it doesn't play there, the problem is in the file's CSS or paths.
LoopMark Studio: Your Animated SVG Logo, Done For You (CSS Draw-On, No JavaScript, 48-Hour ยท $39.00
Get it on Gumroad