I was using Omega and needed to make Youtube embeds be responsive to match my responsive design (without installing any module) and have them resize correctly along with the rest of my content. After some Googling and research, I came up with this solution.
The trick from WebDesignerWall is very simple. You need to wrap the embed code with a
- First you will need to add the following to your CSS
position: relative;
padding-bottom: 56.25%;
padding-top: 30px;
height: 0;
overflow: hidden;
text-align: center;
margin-bottom: 5px;
}
.video-container iframe,
.video-container object,
.video-container embed {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
- Then add the HTML
- Result, Responsive YouTube Example
Now, your YouTube video should re-size depending on the browser size or device width.
Voilà !
Add new comment