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
Related
I have a full page height and width background image to a page that is designed to cover the who back of the viewport that also adapts to the size of the viewport. This work brilliantly on desktop - however on mobile (both iPhone and Android) when the address bar and navigation bars are hidden (default browser behavior) as you scroll down the background image jumps (as seen below):
https://ibb.co/7jWLqWh
The code I'm using for this is:
HTML:
<div id="bg">
<img src="../../assets/landing-page/bg.png" alt="">
</div>
CSS:
#bg {
position: fixed;
top: -32%;
left: -90%;
width: 200%;
height: 200%;
background-color: #FFFFFF;
}
#bg img {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
min-width: 50%;
min-height: 50%;
opacity: 0.75;
}
As % values are being used, when there is suddenly more space because a browser bar has disappeared, the size suddenly jumps.
To get round this problem the suppliers decided to fix the vh height unit. While this can cause other problems, like full height 100vh divs having the bottom cut off when a website is entered, it was designed to help mitigate the sort of scrolling-jump problem seen here.
Suggestion is that you try defining the heights in vh units rather than %s to see if that fixes things.
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;
}
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*/
}
}
I am trying to play a certain video inside a PNG image of an iPhone. The iPhone is serving as a frame for the video. I was able to achieve this using this CSS code:
#phone_container {
width: 343px;
/* Adjust Phone image width */
height: 663px;
/* Adjust Phone image height */
position: relative;
}
#phone_container:after {
content: '';
display: block;
background: url('iphone png link') no-repeat top left transparent;
width: 100%;
height: 100%;
left: 0px;
top: 0px;
position: absolute;
z-index: 10;
}
#video-placeholder {
position: absolute;
top: 125px;
/* Adjust top position */
left: 55px;
/* Adjust left position */
z-index: 5;
}
I was also able to achieve this using this HTML code:
<div class="row demo-video">
<div class="col-md-5 left-side" id="phone_container">
<div>
<iframe id="video-placeholder" src="Video Link" width="270" height="464" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
</div>
</div>
Although it is working perfectly fine, the only problem is that since the z-index of the iframe is less than the image. The Vimeo player controls are not working. I tried setting the z-index of the player controls higher than that of the iPhone but it's still not working. It's also not responsive. How do I fix this problem? Any suggestions?
Create a div element and set its width and height attributes in CSS. Then apply the background-image for that div. Then you can try to embed the vimeo video within that div:
<div class="vimeo-video">
<!-- vimeo embed link with appropriate width and height //-->
</div>
Add CSS like this:
.vimeo-video {
background-image: url('link-to-png.png');
background-attachment: fixed;
background-repeat: no-repeat;
background-size: 100% 100%;
padding-top: /* play around with this to fit the video */;
padding-bottom: /* play around with this to fit the video */;
padding-left: /* play around with this to fit the video */;
padding-right: /* play around with this to fit the video */;
}
Keep padding values in percentages to enable a responsive design.
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