✦ A decade of Canvas craft, now driven by AI, describe it, watch it build live.Start building
← Back to Blog
Canvas Tips & Tutorials

Canvas Parallax Sections: Adding Depth and Motion to Your Pages

Canvas BuilderAugust 20, 20268 min read
Dual-colored wall with blank white canvas

Flat pages convert, but pages with motion hold attention, and in a browser landscape saturated with identical grid layouts, a well-executed parallax section can be the single design decision that keeps a visitor scrolling instead of leaving.

Key Takeaways

  • The Canvas HTML Template includes native parallax support via data attributes, requiring zero additional JavaScript libraries when configured correctly.
  • Parallax depth is controlled through a single numeric data attribute, making speed adjustments fast and predictable without touching Canvas core files.
  • Parallax performs best on hero sections, testimonial dividers, and full-width feature rows, and performs worst on dense content blocks where readability is critical.
  • Accessibility and mobile performance must be planned alongside visual design, not added as an afterthought, to keep Core Web Vitals healthy in 2025 and beyond.

How Canvas Parallax Works Under the Hood

Canvas ships with its own scroll-effect engine baked into js/functions.bundle.js. Unlike third-party parallax plugins that require separate CDN calls or npm installs, Canvas intercepts scroll events natively and repositions background layers based on viewport progress. This keeps the HTTP request count low and avoids version-conflict issues that plague plugin-heavy setups.

The mechanism works by attaching a CSS background-position calculation to any element carrying the data-parallax attribute. As the browser scrolls, the bundled script reads the element’s position relative to the viewport and shifts its background at a fraction of the scroll speed. The result is the classic depth illusion: the foreground content moves at normal speed while the background drifts more slowly.

Because Canvas is built on Bootstrap 5, the parallax sections slot cleanly into the standard container and section grid. You do not load Bootstrap from a CDN separately; it is already bundled inside js/plugins.min.js and style.css. Attempting to load an additional Bootstrap CDN link will cause style conflicts and double-load penalties.

a window in a wall with graffiti on it
Photo by Michal Balog on Unsplash

Adding a Parallax Section to a Canvas Page

The minimum viable parallax section in Canvas requires three things: a section element with a background image, the data-parallax attribute set to "scroll", and a data-image-src attribute pointing to your image path. Canvas’s initialisation script picks up these attributes on DOM ready and wires the motion logic automatically.

<section
  class="section py-6"
  data-parallax="scroll"
  data-image-src="images/backgrounds/hero-landscape.jpg"
  data-speed="0.4"
  data-no-retina>

  <div class="container">
    <div class="row justify-content-center text-center">
      <div class="col-lg-7">
        <h2 class="text-white fw-bold mb-3">Built for Motion</h2>
        <p class="text-white lead">Scroll depth creates the illusion of three-dimensional space on a flat screen.</p>
      </div>
    </div>
  </div>

</section>

The data-speed attribute accepts a decimal between 0.1 and 1.0. A value of 0.4 means the background moves at 40 percent of the scroll speed, which is a comfortable middle ground that reads as depth without feeling dizzying. Values above 0.7 start to look mechanical on wider monitors. The data-no-retina flag tells Canvas to skip the automatic high-DPI image swap, which is useful when you have already supplied a sufficiently large image and want to avoid a redundant second request.

Combining Parallax with Overlays and Canvas Theme Variables

A raw background image behind white text often fails contrast checks. Canvas makes it straightforward to layer a semi-transparent overlay using a utility div inside the section, coloured with the –cnvs-themecolor variable so it inherits your site’s brand colour automatically.

.parallax-overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(var(--cnvs-themecolor-rgb), 0.55);
  z-index: 0;
}

.parallax-overlay + .container {
  position: relative;
  z-index: 1;
}

Note that Canvas uses –cnvs-themecolor and –cnvs-themecolor-rgb as its primary colour tokens, not --bs-primary or --color-primary. Using the wrong variable name means the overlay colour will not update when a client switches their Canvas theme colour, breaking the whole customisation chain. This is one of the most common mistakes developers make when adapting Canvas demos to new brand palettes.

If you are building a site where brand storytelling carries commercial weight, such as a digital agency portfolio, pairing a branded overlay with a full-bleed parallax image in the case study section creates a premium, editorial feel without any custom JavaScript.

a white wall with orange and black shapes
Photo by Sufyan on Unsplash

Choosing the Right Sections for Parallax Effects

Not every section benefits from motion. Applying parallax indiscriminately is a common junior mistake that creates visual noise and, more practically, hurts performance on mid-range Android devices where background-position recalculation on every scroll tick is expensive.

Canvas parallax delivers the highest return in these contexts:

  • Hero sections: A slow-drifting landscape or architectural photograph behind a bold headline immediately signals production quality. The effect is most pronounced when the hero is at least 80vh tall.
  • Divider rows between content sections: A narrow parallax band (around 300px) used as a visual break between a features grid and a testimonials block adds rhythm without overwhelming content.
  • Full-width feature callouts: When you need to showcase a single powerful statement, for example a product launch or a service differentiator, parallax gives the row its own cinematic weight.

Avoid parallax on:

  • Dense text sections where the moving background competes with readability
  • Pricing tables and comparison blocks where the user needs to concentrate
  • Mobile-only sections, where Canvas correctly disables the parallax effect anyway (background-attachment: fixed does not work reliably on iOS Safari)

For luxury and property websites, parallax is almost mandatory. If you are working in that niche, the breakdown in 8 design elements every luxury property website needs covers how motion design fits into a broader visual strategy.

Performance, Accessibility, and Core Web Vitals

Parallax sections that use large uncompressed images are one of the fastest ways to destroy a Largest Contentful Paint score. In 2025, Google’s CWV thresholds are strict: LCP must be under 2.5 seconds. A 4MB hero image running a parallax effect on a 4G connection will blow past that threshold every time.

Follow these four rules to keep parallax sections fast:

  1. Serve background images in WebP format at 1.5x the section’s maximum rendered width. For a full-viewport section on a 1440px monitor, that means a 2160px WebP at under 300KB is your target.
  2. Add loading=”lazy” logic for below-the-fold parallax sections using an Intersection Observer in a small custom script so the image is not in the critical render path.
  3. Use will-change: transform on the parallax container to promote it to its own compositing layer, which moves scroll calculations off the main thread on modern browsers.
  4. Always include a prefers-reduced-motion media query that disables the parallax scroll effect for users who have set their OS-level accessibility preference. Canvas does not handle this automatically, so you need to add it to your custom CSS file.
@media (prefers-reduced-motion: reduce) {
  [data-parallax="scroll"] {
    background-attachment: scroll !important;
    background-position: center center !important;
  }
}

This single block respects user accessibility settings without removing the background image entirely, maintaining the visual design for the vast majority of users while honouring the preference for those who need it.

Building Parallax Sections Faster with Canvas Builder

Manually writing and testing parallax section markup is straightforward once you know the attribute names, but it becomes repetitive across a multi-page Canvas build where you might need five or six distinct parallax moments. Canvas Builder generates production-ready Canvas HTML sections from a plain-language prompt, including the correct data-parallax, data-image-src, and data-speed attributes, so you spend time on design decisions rather than attribute lookup.

The workflow documented in From Prompt to Production: A Real Canvas Builder Workflow shows how quickly a full-page layout with multiple scroll effects can go from a brief to browser-ready code, which is particularly useful when a client requests changes to section order or background imagery at the end of a project sprint.

For hero section design specifically, combining Canvas parallax with strong typographic hierarchy amplifies the effect considerably. The principles in How to Design Hero Sections That Grab Attention Instantly apply directly here: the motion draws the eye, but the headline must do the converting.

Frequently Asked Questions

Does Canvas parallax work on mobile devices?

Canvas disables the parallax scroll effect on mobile browsers by default because background-attachment: fixed is not supported reliably on iOS Safari and causes visual glitches on many Android browsers. On mobile, the background image is treated as a standard static background. This is the correct behaviour and should not be overridden.

Which JavaScript file handles the parallax effect in Canvas?

The parallax initialisation is handled by js/functions.bundle.js, which is one of the two required Canvas JS files alongside js/plugins.min.js. Both files must be loaded in the correct order for parallax and other Canvas interactions to work. Do not attempt to load parallax separately from a CDN.

Can I use a video background instead of an image for a parallax section?

Canvas supports video backgrounds through its own video background data attributes, but this is a separate feature from the parallax scroll effect. You cannot directly combine data-parallax=”scroll” with a video source in the same section. If you want motion in a hero section with video, use Canvas’s native video background attributes without the parallax data attribute.

How do I change the parallax speed in Canvas?

Set the data-speed attribute on your parallax section element to a decimal between 0.1 and 1.0. Lower values produce a slower, more subtle drift (0.2 to 0.4 is recommended for most use cases). Higher values above 0.7 can feel unnatural on large monitors. There is no Canvas admin panel setting for this; it must be set directly in the HTML attribute.

Does adding parallax sections hurt my Google Core Web Vitals score?

It can, if background images are not optimised. The parallax effect itself adds minimal JavaScript overhead when run via Canvas’s bundled engine, but large uncompressed background images are a common cause of poor LCP scores. Serve images in WebP format, compress them below 300KB for full-width sections, and use a prefers-reduced-motion CSS rule to disable the scroll animation for accessibility-sensitive users.

If you’re working with the Canvas HTML Template and want to generate production-ready layouts faster, try Canvas Builder free and see how much time you save on every project.

Related Posts