Introduction
Backdrops provide a useful design pattern—placing a translucent image behind contextual content. Backdrops offer two distinct style variants: Image proportional and fixed height.
Backdrops remove the need for CSS background images. Feature images exist within the HTML, so screen readers can read the text of the image's alt attribute.
Image Proportional
Image proportional backdrops scale and stack responsively. Below is an example of a basic image proportional backdrop.
Line # | Details |
---|---|
1 | The parent The The |
3-11 | The It contains the feature image. The It is where you provide a credit for the image. |
13-24 | The It holds the backdrop's contextual content. |
The size of this backdrop (proportional width and height) is determined by the size of its feature image.
The translucent effect of the backdrop is acheived with the use of additional utility classes. Our theme color utilities (e.g. .theme-dark
) provide the background and text color. The opacity utility class (e.g. .opacity-30
) applied to the backdrop's feature image, allows the background color to show through.
Stack Breakpoint Modifiers
When using image size proportional backdrops for featured content (like the full-width example below) the backdrop may become too tall for the image on smaller viewport sizes.
Photo by Aniket Deole
The mountain at a given distance In amber lies
—Excerpt from Delight becomes pictoral
To occomodate small viewports, include a stack breakpoint modifier (e.g. .backdrop--stack--{x}
) to the .backdrop
selector. Where x equals the desired breakpoint (e.g., lg for large). The backdrop's image is placed above the content vertically until the viewport reaches the desired breakpoint specified in the modifier.
To see this in action, resize your browser window to a smaller viewport size. Notice, too, the image is at full opacity. That's because opacity utilities have their own a breakpoint modifiers. Adding .opacity-40--lg
to the .backdrop__image
selector gives that image a specified opacity (40%) at the large (lg) breakpoint.
Figure 2 (below) provides code used to create the backdrop above. Refer specifically to line 1, where the .backdrop--stack--lg
breakpoint modifier is present.
All of this together makes it easy to create responsive backdrops with different themes and content. What if we don't want our backdrop's size to be dictated by its feature image?
Fixed Height
Fixed height backdrops retain their height across viewport sizes. When needed, they adjust to the height of their inner content.
For a fixed height backdrop, append the .backdrop--fixed
modifier to the .backdrop
selector.
Photo by Jane Doe on Unsplash
The Mountain sat upon the Plain
The .backdrop--fixed
selector stretches to fit the content within .backdrop__cover
. Consider the following layout:
Photo by Alberto Restifo
Nature in Poetry
Featured Poem
This—is the land—the Sunset washes—
This—is the land—the Sunset washes—
These—are the Banks of the Yellow Sea—
Where it rose—or whither it rushes—
These—are the Western Mystery!
Night after Night
Her purple traffic
Strews the landing with Opal Bales—
Merchantmen—poise upon Horizons—
Dip—and vanish like Orioles!