How to make YouTube videos scale in all browsers, tablets and phones for responsive design?
Hello guys all you need to do for scale a YouTube video to fit any browser, tablet or mobile device for responsive design is to use a simple CSS solution.
The first thing that you need is the YouTube iframe embed code, grab that in your video share options from the YouTube site and place the iframe code on your web page. See below how it looks like...
And yes please remove height and width from the iframe. Now we need to add in a HTML container around the video and declare the CSS.
Now set Up the HTML and CSS Styles, Create a container div around the iframe code and give it a class see below...
Now add css for that...
First CSS declarations target the video container and the second target what is in the container, in this case it's the iframe, you can also apply this to objects and embed elements.
You are done the video will now scale as the viewport is resized. Thanks Hope you will like it.
Creative Website Designer