Adaptive background
The page background changes color as you scroll from one section to the next. Dark presets also switch the text and cards in that section.
How it works
Give a section a data-adaptive value. When that section reaches the middle of the screen, the whole page background fades to its color. The section itself has no background of its own, so it blends in. Scroll the modern home page to see it: warm sand, then near-black, then forest green.
<section class="section" data-adaptive="warm"> ... </section> <section class="section" data-adaptive="dark"> ... </section> <section class="section" data-adaptive="#E8EDE7"> ... </section>
The brand and dark presets also switch text, cards and buttons inside the section to the dark colors, so everything stays readable. A custom color such as #E8EDE7 only changes the background, so pick a light one. Sections without the attribute keep their own background and the page color returns to normal. If JavaScript is off, the sections simply keep the normal page background.
Live preview
Keep scrolling. Each block below is a real data-adaptive section. Watch the page background change as it reaches the middle of the screen, then come back up to see it fade back.
Soft sand
A light sand page color. Cards keep their normal look.
Fast viewings
Book a slot in two taps.
Honest prices
No hidden fees, ever.
Local agents
People who know the street.
Green-grey surface
Good for calm, alternate sections between white ones.
Fast viewings
Book a slot in two taps.
Honest prices
No hidden fees, ever.
Local agents
People who know the street.
Forest green
Text and cards switch to their dark-mode colors automatically.
Fast viewings
Book a slot in two taps.
Honest prices
No hidden fees, ever.
Local agents
People who know the street.
Near black
The strongest contrast. Great for a gallery or video section.
Fast viewings
Book a slot in two taps.
Honest prices
No hidden fees, ever.
Local agents
People who know the street.
Any light color
A hex value only changes the background, so choose a light one.
Fast viewings
Book a slot in two taps.
Honest prices
No hidden fees, ever.
Local agents
People who know the street.
Classes and attributes
| Name | Purpose |
|---|---|
data-adaptive="warm" | Soft sand page color. |
data-adaptive="surface" | The light green-grey surface color. |
data-adaptive="brand" | Forest green page color, with dark-mode text and cards inside the section. |
data-adaptive="dark" | Near-black page color, with dark-mode text and cards inside the section. |
data-adaptive="#hex" | Any color. Background only. |
html.has-adaptive | Added by the script when the page has adaptive sections. All styles depend on it. |
--adaptive-bg | Set on body by the script. Change the fade speed in adaptive-bg.css. |