All courses Custom code in Webflow

Try it: add page-level code

Go to the next lesson

Try it: add page-level code

Add real, working code at the page level

Try it: add page-level code

Add real, working code at the page level

Next, you’ll add a small banner on a single page. You might use something like this for a page-specific announcement, campaign notice, or temporary message.

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: Choose a page

Pick any page on your site. This can be the same page you used in the previous activity.

Step 2: Open Page settings

  1. Open the Page settings for your chosen page.
  2. Scroll to the Custom code section.

Step 3: Paste the script

Paste the code below into the Before \</body> tag field:

<script>
  const notice = document.createElement("div");
  notice.textContent = "✨ Page-level custom code is working here.";
  notice.style.cssText = `
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 14px;
    background: #146EF5;
    color: #FFFFFF;
    font-size: 14px;
    border-radius: 8px;
    z-index: 9999;
  `;
  document.body.appendChild(notice);
</script>

Save the page settings.

Step 4: Preview or publish to staging

Enter Preview mode and make sure Enable custom code is toggled on. Or, publish your site to staging, then open the 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 blue banner at the top of this page that says '✨ Page-level custom code is working here.'

Page-level banner visible on a single page of a Webflow site.

Extras:

  • Try changing the message text (content within the banner).
  • Try changing the banner style by adjusting the CSS properties for color, font-size, or border-radius.

You got this.

Now that you've got page-level code down, explore site-level code in the next activity.

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

Try it: add site-level code

Test real, working code at the site level

Continue to next lesson → Complete course ✓