responsive video iframe for mobile and laptop [duplicate] - html

This question already has answers here:
Making an iframe responsive
(24 answers)
Closed 5 years ago.
I'm trying to make a responsive template and I'm using iframes for youtube videos.
When i put a caption underneath the video it works fine on desktop, but when I go to responsive mobile mode there is big between caption and video.
Can any body help me to fix it, so that caption stay underneath the video regardless wether I'm on desktop or mobile.
Here is the link for my template:
http://www.sayarts.com/past-events.html

You are not using the right approach to make your videos responsive. Height for your videos remain fixed that's why their is huge gap between videos and caption on mobile phones.
To make the videos perfectly responsive, add the video inside a div like this:
<div class="videoWrapper">
<!-- Copy & Pasted from YouTube -->
<iframe width="560" height="349" src="http://www.youtube.com/embed/n_dZNLr2cME?rel=0&hd=1" frameborder="0" allowfullscreen></iframe>
</div>
and then use the following CSS:
.videoWrapper {
position: relative;
padding-bottom: 56.25%; /* 16:9 */
padding-top: 25px;
height: 0;
}
.videoWrapper iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
You can read more about it in this article

You can simply add this style to the wrapper element: height:auto, it seems to fix the problem.
#wrapper embed, #wrapper iframe {
max-width: 100%;
height: auto;
}
If you need more control use the responsive media queries, this is an example:
#media only screen and (max-width: 468px) {
body {
/*you specific styles*/
}
}

Related

Having issues making an embedded youtube responsive but not so huge on my desktop display

I am trying to make my responsive embedded youtube video not appear so large on a regular desktop display. It looks fine in mobile, but when trying to adjust the size to make it look good on desktop it ruins the responsive on mobile.
I've tried adjusting the width / height % in css which allows me to resize in desktop but ruins the responsiveness in mobile.
.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%;
}
<div class="video-container">
<iframe width="853" height="480" src="https://www.youtube.com/embed/z9Ul9ccDOqE" frameborder="0" allowfullscreen>
</iframe>
</div>
I am trying to get my embedded video to look like a normal sized video but yet responsive. Currently it takes up the entire screen.
here is a photo of the desktop display.
Use the max-width CSS property to set a hard limit for where you want the video to stop expanding. That way, if the user is using something such as an ultrawide monitor, your content will cap where you want it to.
Here's an example:
.expandable{
width: 80%
max-width: 1200px;
}

Why does does two videos i'm using overlap each other?

I'm building a website and the two videos I'm using overlap and I can't figure out why. I'm using two classes and I've taken out the top and left and it still over laps. I'm also curious why instead of the video being small the video is being cut out. the video will either play the top half or the bottom half of the video but my actually question is why the two videos overlap and how can I fix it.
#media only screen and (max-device-width:480px) {
/* styles for mobile browsers smaller than 480px; (iPhone) */
.center {
width: 300px;
height: 100px;
position: fixed;
/*left: 48.5%;
top: 44%;*/
transform: translate(-50%, -50%);
}
.embed-container {
position: relative;
width: 100%;
height: 0;
padding-bottom: 56.27198%;
background-size: cover;
background-repeat: no-repeat;
background-position: center center;
}
}
.embed-container iframe {
position: absolute;
width: 50%;
height: 50%
}
<!--stackover flow trying to get the videos to shirnk when using mobile devices. need to be done for "ipad" and cell phones from my knowlegde computers are fine. -->
<p align="center">
<div class="embed-container">
<iframe src="https://www.facebook.com/plugins/video.php?href=https%3A%2F%2Fwww.facebook.com%2Fwhereisslice%2Fvideos%2F1034464440067039%2F&show_text=0&width=560">
</iframe>
</div>
</p>
<p align="center">
<div class="embed-container">
<iframe src="https://www.facebook.com/plugins/video.php?href=https%3A%2F%2Fwww.facebook.com%2FTimeOutForMeInc%2Fvideos%2F526931557744638%2F&show_text=0&width=267">
</iframe>
</div>
</p>
To answer your first question looks like you have the videos set to position absolute. Removing that position rule from the class .embed-container iframe will get the videos stacked on top of each other.
Why the videos themselves are being cut off is because you are constraining the hight property in .embed-container iframe as well. If you inspect the video play in the iFrame you will notice that Facebook is giving it a set pixel hight. You ought to be able to fix this by removing your set height in .embed-container iframe

pdf in iframe only first page on iphone/ipad

I am trying to display the content of a pdf with an iframe. Everything is working fine on a normal computer. However on mobile devices of apple (IPhone/IPad) only the first page of the pdf is getting displayed.
Here is my code where I already added some scrolling styles because I thought it was a problem related to the scrolling, but If I make the iframe very small it is possible to scroll! However the problem is still the same...only the first page is visible.
<div class="scroll-wrapper">
<iframe height="260" width="280" src="info.pdf"> </iframe>
</div>
.scroll-wrapper {
overflow-y:scroll;
-webkit-overflow-scrolling:touch;
width: 400px;
height: 300px;
}
Maybe you should try using viewport.
Or using responsive breakpoints
#media screen and (max-width:512px) {
size:
}
#media screen and (max-width:512px) {
.scroll-wrapper{
overflow-y:scroll;
-webkit-overflow-scrolling:touch;
width: 400px;enter code here
height: 300px;
}
}
try this
iframe {
width: 100% !important;
}

How to make iFrame responsive in iPhone 6?

I have added an iframe and it is working fine in all browsers and some devices but in iphone 6. The iframe is not responsive. It does not fit 100% of iphone screen size.
I found many solutions online but most of them showed how to make an iFrame scroll in iphone. I dont need that. I want to make it responsive and adjust according to screen size.
<div class="frame-container" style="position: relative; padding-bottom: 65.25%; padding-top: 30px; height: 0;">
<iframe id="frame" width="100%" height="1000px" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"></iframe >
</div>
I have removed the src="" in iframe in the sample above
From the screen shot it can be seen that the iframe is not responsive and a horizontal scroll appears. During loading the iframe is according to the devices viewport but once it is fully loaded the iframe takes the full width and the horizontal scroll appears.
Checking on browser stack
This problem is solved, simply had to apply this styling. I did an inline-css to this.
width: 1px;
min-width: 100%;
*width: 100%;
Here is a link to a more detail answer

responsive iframe in responsive html website [duplicate]

This question already has answers here:
Making an iframe responsive
(24 answers)
Closed 8 years ago.
i am trying to make an iframe responsive, in order to be correctly viewed on mobile devices etc, and what i am doing, although it is working good on mobile devices, it ruins the iframe on normal displays.
the iframe is that
<div class="conti" align="center" >
<iframe id="extFrame" src="html5/Project1.html" height="600px" width=" 800px"></iframe>
</div>
and the css style is
<style>
.conti {
position: relative;
padding-bottom: 75%;
height: 0;
overflow: hidden;
}
.conti iframe {
position: absolute;
top:0;
left: 0;
width: 100%;
height: 100%;
}
</style>
that above makes the iframe full width but i want it 800*600.
any help?
Just delete witdh and height properties defined on css styles and the iframe will be generated with your desired dimensions.
I hope it helps. But are you just giving one size for every device? This is not responsive at all... You have to add some media queries.
This is a good post with different media queries for Responsive Design:
Media Queries for Responsive Design
If you want it 800x600 then say you want it 800x600 instead of 100%x100%.
width: 800px;
height: 600px;