First of all wrap the video embed code with a ’div’ and specify a 30% to 40% padding bottom depending on the size. Then, name and specify the child elements i.e ‘iframe’, ‘object’, ‘embed’ as having 100% width, 100% height with absolute position. This forces all the embed elements to expand to full-width automatically! Exactly what we are looking for! Here is the html mark up
Now just add the following CSS to your style sheet.
.video-container {
position: relative;
padding-bottom: 56.25%;
padding-top: 30px; height: 0; overflow: hidden;
}
.video-container iframe,
.video-container object,
.video-container embed {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
Loading Conversation