cssreactjsdocusaurus

Embed a video into Docusaurus that occupies 100% of the width


I'm building a website by V2 Docusaurus.

I want to embed a youtube video into the page. I want the width of the frame to be 100% of the page. I tried a lot of solutions, but have not found the perfect one. At the moment, i'm using the following code:

<iframe width="675" height="380" src="https://www.youtube.com/embed/_AQXQDjw7Y8" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

It works well in desktop, but i realize that it does not work well in phone:

enter image description here

Does anyone have any idea?


Solution

  • Not a Docusaurus-specific issue.

    <iframe width="675" ... />

    You're hardcoding a width value which is larger than most mobile device widths, so that's expected. See how the Flux docs does it in https://github.com/facebook/flux/blob/master/docs/In-Depth-Overview.md.