Background Video Component
The background video component (.bg-video) creates an ambient, cinematic effect by playing a looping video behind content sections. It’s used in the Stories section to add visual interest and movement to customer testimonials.
Overview
The background video component provides:- Full-width, full-height video coverage
- Low opacity (10%) for subtle ambient effect
- Absolute positioning behind content
- Auto-play, muted, looping video
- Multiple source formats for browser compatibility
HTML Structure
index.html:241
Sass Implementation
sass/components/_bg-video.scss
Component Structure
Container (.bg-video)
Positioning:
- Position: Absolute to remove from document flow
- Dimensions: 100% width and height to fill parent section
- Top/Left: 0 to align with section edges
- Z-index: -1 to place behind all content
- Overflow: Hidden to prevent video from extending beyond bounds
- Opacity: 0.1 (10%) creates a subtle, non-distracting background
- The low opacity ensures text remains readable while adding atmosphere
Video Element (.bg-video__content)
Sizing:
- Width/Height: 100% to fill container
- object-fit: Cover ensures video fills area without distortion
- autoplay: Video starts playing automatically
- muted: Required for autoplay to work in most browsers
- loop: Video repeats indefinitely
Video Sources
The component includes two video formats for maximum browser compatibility:- MP4 (H.264): Supported by Safari, Chrome, Firefox, Edge
- WebM (VP8/VP9): Supported by Chrome, Firefox, Opera
- Browsers automatically select the first format they support
<video> element (extremely rare).
object-fit: cover
Theobject-fit: cover property is crucial for responsive video:
- Video maintains its aspect ratio
- Fills the entire container
- Crops edges if necessary to avoid letterboxing
- Similar to
background-size: coverfor images
Section Implementation
The background video is placed at the start of the Stories section:index.html:240
z-index: -1.
Why Opacity 0.1?
The extremely low opacity (10%) is intentional:Readability
Ensures text remains highly legible over the video
Subtlety
Creates ambiance without distraction
Performance
Low visibility means slight performance impact is acceptable
Atmosphere
Adds movement and life to static content
Browser Autoplay Policies
Performance Considerations
Accessibility Considerations
Reduced Motion: Users with vestibular disorders may be sensitive to motion. Consider adding:CSS Properties Explained
position: absolute
Removes the video from normal document flow and positions it relative to the nearest positioned ancestor (the section).z-index: -1
Places the video behind all other content. Positive z-index values or default stacking will appear in front.overflow: hidden
Prevents video from extending beyond container boundaries if aspect ratios don’t match perfectly.opacity: .1
Makes the video 90% transparent, creating a subtle background effect.Common Variations
Higher opacity for more prominence:Video Content Guidelines
Best practices for background videos:- Abstract motion: Avoid specific actions or text in video
- Slow movement: Fast motion is distracting
- Seamless loops: Ensure start/end frames match for smooth looping
- No audio: Always mute background videos
- Complementary: Video should enhance, not dominate the content
Browser Support
The background video technique is widely supported:| Feature | Support |
|---|---|
<video> element | All modern browsers |
autoplay (muted) | Chrome, Firefox, Safari, Edge |
object-fit: cover | Chrome 32+, Firefox 36+, Safari 10+, Edge 16+ |
| Multiple sources | All browsers with <video> support |
Related Concepts
Story Component
Displays content on top of the background video
Animations
Other techniques for adding movement to the page