![]() Plus there is the hopefully-will-exist-soon aspect-ratio in CSS and the idea that it could default to use the width and height attributes on the element, which I hope would extend to iframes. There is the experimental intrinsicsize attribute that I could imagine being quite nice for iframes in addition to images. Responsive Iframe by Chris Coyier ( CodePen.Įvery time we’re dealing with aspect ratios, it makes me think of a future with better handling for it. I’ll just put a complete demo right here (that works for images too): In the scenario where the content inside is taller than what the aspect ratio accounts for, it can still grow rather than overflow. The whole point of it is that pushing the element to the correct size is a nicer system than forcing a certain height. ![]() The tricky part is that the parent element becomes the perfect height by creating a pseudo-element to push it to that height based on the aspect ratio. Since the URL sets the autoplay parameter to 1, the video. The iframe is the child element inside it, which you apply absolute positioning to in order to fill the area. The
0 Comments
Leave a Reply. |