Webflow sync, pageviews & more.
NEW

Why does the video I want to embed in Webflow have large black borders above and below it, despite being the desired size on YouTube?

TL;DR
  • Ensure the YouTube video is 16:9 before uploading to avoid automatic padding.
  • Use Webflow’s Video Element with the direct YouTube URL for proper scaling.
  • If embedding manually, wrap the <iframe> in a div with padding-top: 56.25% for 16:9 scaling.
  • Check if YouTube added black bars and re-export the video in 16:9 if necessary.
  • Modify the embed URL (?rel=0&modestbranding=1) and adjust CSS settings to remove unwanted borders.

Your embedded YouTube video has black borders because of aspect ratio mismatches between the video and the container it’s placed in. Webflow maintains aspect ratios automatically, but conflicts can arise due to settings or styling.

1. Check the YouTube Video’s Aspect Ratio

  • Most YouTube videos use a 16:9 aspect ratio (e.g., 1920x1080).
  • If your video has a different aspect ratio (e.g., 4:3 or a custom size), YouTube may add black padding to fit the 16:9 display.

2. Use Webflow’s Responsive Video Embed

  • Go to Webflow Designer and insert a Video element (not an Embed Code Block).
  • Paste the direct YouTube URL (not an iframe).
  • Webflow automatically applies responsive scaling for 16:9 videos.

3. Check if the YouTube Player Adds Padding

  • If your video has black bars on YouTube itself, YouTube has likely padded it.
  • Use video editing software to export the video in a true 16:9 resolution before uploading.

4. Adjust Webflow Video Embed Styling

  • If using a manual <iframe>, wrap it in a div with custom styling:
  • Set the container width to 100% and height to auto.
  • Set padding-top: 56.25% (for 16:9).
  • This ensures correct scaling without unwanted borders.

5. Use YouTube’s Embed Modifiers

  • Add ?rel=0&modestbranding=1 to the embed URL to remove unnecessary branding.
  • If using an iframe, prevent extra padding by setting frameborder="0" and checking CSS margins.

Summary

Black borders occur due to aspect ratio mismatches or YouTube's automatic padding. Ensure your video is 16:9 natively, use Webflow’s Video Element, or adjust CSS for a manual embed to properly fit the container.

Rate this answer

Other Webflow Questions