Backgrounds
Background Attachment
Utilities for controlling how a background image behaves when scrolling.
Quick reference
Class | Description |
---|---|
bg-fixed | background-attachment: fixed |
bg-local | background-attachment: local |
bg-scroll | background-attachment: scroll |
Basic usage
Fixed
Use bg-fixed
to fix the background image relative to the viewport.
The science
March 9th, 2023 · 14 min read
General Relativity states that space and time are fused and that nothing can travel faster than the speed of light. General relativity also describes how mass and energy warp spacetime – hefty objects like stars and black holes curve spacetime around them. This curvature is what you feel as gravity and why many space-faring heroes worry about “getting stuck in” or “falling into” a gravity well.
In some respects the force was electricity, but it was of a higher energy order, containing inherent magnetic properties in a complete union of a kind only vaguely suggested by the term “electromagnetic,” in which the two forces involved are more or less mutually exclusive, the one giving rise to the other.
<div class="bg-fixed ..."></div>
Local
Use bg-local
to scroll the background image with the container and the viewport.
The science
March 9th, 2023 · 14 min read
General Relativity states that space and time are fused and that nothing can travel faster than the speed of light. General relativity also describes how mass and energy warp spacetime – hefty objects like stars and black holes curve spacetime around them. This curvature is what you feel as gravity and why many space-faring heroes worry about “getting stuck in” or “falling into” a gravity well.
In some respects the force was electricity, but it was of a higher energy order, containing inherent magnetic properties in a complete union of a kind only vaguely suggested by the term “electromagnetic,” in which the two forces involved are more or less mutually exclusive, the one giving rise to the other.
<div class="bg-local ..."></div>
Scroll
Use bg-scroll
to scroll the background image with the viewport, but not with the container.
The science
March 9th, 2023 · 14 min read
General Relativity states that space and time are fused and that nothing can travel faster than the speed of light. General relativity also describes how mass and energy warp spacetime – hefty objects like stars and black holes curve spacetime around them. This curvature is what you feel as gravity and why many space-faring heroes worry about “getting stuck in” or “falling into” a gravity well.
In some respects the force was electricity, but it was of a higher energy order, containing inherent magnetic properties in a complete union of a kind only vaguely suggested by the term “electromagnetic,” in which the two forces involved are more or less mutually exclusive, the one giving rise to the other.
<div class="bg-scroll ..."></div>