ParallaxSection
ParallaxSection renders a CSS-only background image section with a configurable overlay. It is useful for landing pages, editorial sections, hero breaks, and showcase pages.
Quick Start
from faststrap import Button, ParallaxSection
ParallaxSection(
Button("Explore rooms", variant="light"),
img_src="/static/hotel.jpg",
height="520px",
overlay_opacity=0.45,
)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
*children |
Any |
empty | Content centered inside the section overlay. |
img_src |
str |
required | Background image URL. |
height |
str \| None |
500px |
Section height. |
overlay_opacity |
float \| None |
0.5 |
Overlay opacity clamped between 0 and 1. |
Notes
- Mobile browsers often handle
background-attachment: fixedpoorly, so Faststrap automatically falls back to normal scrolling below768px. faststrap-visual.cssis loaded automatically byadd_bootstrap().- Treat
img_srclike any other image URL: pass trusted/static paths, not unescaped user input.
API Reference
faststrap.components.layout.parallax.ParallaxSection(*children, img_src, height=UNSET, overlay_opacity=UNSET, **kwargs)
Render a CSS-only parallax-style background section.