How to make your Embedded YouTube Videos Responsive (HTML & CSS Code provided)

A Designer Who Codes on YouTubeWatch on YouTube

SaveMark complete

Sign in to save videos and track what you’ve finished.

BeginnerWeb Design14 min

About this video

Embedded YouTube videos are not responsive by default. The video shows how to fix this with a small amount of CSS and an extra div, in both vanilla HTML and React or Gatsby projects.

What you’ll learn

  • Wrap an embedded YouTube video in a div to prepare it for responsive sizing
  • Apply a little CSS so the video scales to its container
  • Apply the same fix in vanilla HTML and in React or Gatsby projects