Answer the question
In order to leave comments, you need to log in
How to make iframe inserts responsive?
It is surprising that in the age of responsive design, various services that allow you to embed your content still use fixed values. What if you want all the videos and other crap inserted on the site through iframes not to break the appearance of the site when viewed from mobile devices?
Answer the question
In order to leave comments, you need to log in
.video {
position: relative;
overflow: hidden;
height: 0;
padding-bottom: 54.15%;
}
.video iframe,
.video object,
.video embed {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
}
So set the iframe with YouTube as a percentage. He is quite capable of it.
Similarly, you can resize an iframe on media queries, think of it like a picture.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question