All courses Custom code in Webflow

Try it: add site-level code

Go to the next lesson

Try it: add site-level code

Test real, working code at the site level

Try it: add site-level code

Test real, working code at the site level

Now, you’ll add a small banner that appears on every page of your site. You’d use something like this for cookie notices, site-wide announcements, or temporary alerts.

You don’t need a finished site for this. You can use a blank project or clone a practice site from the Made in Webflow Marketplace, like this Webflow University cloneable.

Step 1: Open Site settings

  1. Go to Site settings.
  2. Click the Custom code tab from the menu on the left.

Step 2: Paste the code

Paste this code into the Footer code field:

<script>
  const banner = document.createElement("div");
  banner.textContent = "🌍 Site-level custom code is running on every page.";
  banner.style.cssText = `
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 16px;
    background: #7A3DFF;
    color: #FFFFFF;
    font-size: 14px;
    text-align: center;
    z-index: 9998;
  `;
  document.body.appendChild(banner);
</script>

Save your changes.

Step 3: Publish to staging

Publish your site to staging, then open any page in your browser. Staging is a safe testing environment, so this won’t affect your live site.

You’ll know this worked if:

  • You see a purple banner at the bottom of every page.
  • On the page where you added page-level code, you see both the blue banner (page-level) and the purple banner (site-level).
  • On all other pages, you see only the purple banner.

Site- and page-level banners visible on a Webflow page.

Extras:

  • Try changing the message text (content within the banner).
  • Try changing the banner position by adjusting CSS property values for bottom, left, or right.
  • Remove the code and republish to see the banner disappear everywhere.

Almost there.

In the final section, we’ll wrap up the course and point you to additional resources for continued learning.

1

Getting started

Getting started

Getting started

Coming soon

1

Background & preview 2:00

Background & preview

Coming soon

1

Where you can add custom code 4:00

Where you can add custom code

Coming soon

2

Adding custom code

Adding custom code

Adding custom code

Coming soon

2

The Code Embed element 6:01

The Code Embed element

Coming soon

2

At the layout level (Code Embed element) 3:00

At the layout level (Code Embed element)

Coming soon

2

Page & site level code 3:36

Page & site level code

Coming soon

2

Page-level code 3:00

Page-level code

Coming soon

2

Site-level code 4:00

Site-level code

Coming soon

2

Adding custom code

Custom code in the Webflow CMS 3:01

Custom code in the Webflow CMS

Coming soon

2

In the Webflow CMS 5:00

In the Webflow CMS

Coming soon

3

Managing custom code

Managing custom code

Managing custom code

Coming soon

3

Previewing, testing, & troubleshooting 5:00

Previewing, testing, & troubleshooting

Coming soon

3

Best practices for maintainable code 4:00

Best practices for maintainable code

Coming soon

4

Wrap up

Wrap up

Wrap up

Coming soon

4

Try it: use the Code Embed element 4:00

Try it: use the Code Embed element

Coming soon

4

Wrap up

Try it: add page-level code 4:00

Try it: add page-level code

Coming soon

4

Wrap up

Try it: add site-level code 4:00

Try it: add site-level code

Coming soon

4

Additional resources 2:00

Additional resources

Coming soon

Course progress

0%

Assessment

Test your knowledge

Up next

Additional resources

Where to go next with custom code

Continue to next lesson → Complete course ✓