Responsive YouTube Iframe
Responsive YouTube Iframe
source code available
Responsive Iframes
Create an iframe that will keep the aspect ratio (4:3, 16:9, etc.) when resized.
What is aspect ratio?
The aspect ratio of an element describes the proportional relationship between its width and its height. Two common video aspect ratios are 4:3 (the universal video format of the 20th century), and 16:9 (universal for HD television and European digital television, and for YouTube videos).
How To - Responsive Iframes ?
Step 1) Add HTML:
Use a container element, like div, and add the iframe inside of it.
Step 2) Add CSS:
Add a percentage value for padding-top to maintain the aspect ratio of the container DIV. The following example will create an aspect ratio of 16:9, which is the default aspect ratio of YouTube videos.
Responsive YouTube Iframe
Tutorial By Ebadallah IT
Source Code
Copy and Paste On Code Editor
Document Developed by Ebadallah IT
Comments
Post a Comment