How can I make a hero video in Webflow automatically adjust size and maintain the 16:9 aspect ratio on tablet and mobile devices?

TL;DR
  • Wrap the video in a div with padding-top: 56.25%, height: 0, width: 100%, and position: relative to maintain 16:9 aspect ratio.  
  • Set the video to position: absolute, top/left: 0, width/height: 100%, and object-fit: cover for responsive scaling.

To create a hero video in Webflow that automatically scales while maintaining a 16:9 aspect ratio, you need to combine layout settings with responsive styling.

1. Wrap the Video in a Responsive Div

  • Add a Div Block around your video element (either a YouTube/Vimeo embed or background video).
  • Give this div a class name (e.g., hero-video-wrapper).

2. Use Padding to Maintain Aspect Ratio

  • Select the wrapper div, go to the Style panel.
  • Set the position to relative.
  • Set padding-top to 56.25% to enforce a 16:9 aspect ratio. (Because 9 ÷ 16 = 0.5625)
  • Set height to 0.
  • Set width to 100%.

3. Style the Video Element

  • Select the actual video element inside the wrapper.
  • Set its position to absolutetop: 0left: 0.
  • Set height: 100%width: 100%.
  • Set object-fit to cover (or contain if you want to avoid cropping).

4. Use the Video Embed Element (if External Video)

  • Drag in an Embed component if you’re using a YouTube or Vimeo link.
  • Use an iframe embed and wrap it in the same aspect-ratio wrapper as above.
  • In the embed, make sure to set width="100%" and height="100%", and add style="position:absolute; top:0; left:0;" if needed.

5. Test Responsive Behavior

  • Check on Tablet and Mobile breakpoints in Webflow.
  • Ensure the wrapper div scales down proportionally and the video fills it correctly without distortion.

Summary

Wrap your hero video inside a div with padding-top: 56.25%height: 0, and position: relative to maintain a 16:9 aspect ratio. Set the video’s position to absolute and size to 100%, with object-fit: cover for full bleed. This ensures that the video scales correctly on all devices while preserving the aspect ratio.

Rate this answer

Other Webflow Questions