I wanted it to be full-width (that is, width: 100%), but keep the normal YouTube aspect ratio. The value of To learn more, see our tips on writing great answers. The
in which the iframe is located also has a height: 100%, thanks, your solution worked! Use a container element, like
, and add the iframe inside of it: Add a percentage value for padding-top to The percentage is proportional to the width of the parent element, Default is 150. The value of the attribute can either be empty to apply all restrictions, or space-separated tokens to lift particular restrictions: The URL of the page to embed. 565), Improving the copy in the close modal and post notices - 2023 edition, New blog post from our CEO Prashanth: Community is the future of AI. Method 2: This method uses the id attribute of the iframe with window.innerWidth property to change the width of