Aligning embedded chat and stream together with css - html

I'm trying to embed a chat along with my twitch stream on a Xenforo (forum software) page. I want the stream to be 16:9 so it's HD, and I want it to adjust based on the user's resolution. Here's what I have so far to do that
<style>
.twitch {I
position: left;
padding-bottom: 56.25%; /* 16:9 */
padding-top: 30px;
overflow: hidden;
}
.twitch iframe {
position: absolute;
top: 0;
left: 0;
}
.chat {
position: right;
padding-bottom: 56.25%;
padding-top: 30px;
overflow: hidden;
}
.chat iframe {
position: absolute;
top: 0;
right: 0;
}
.twitchWrapper {
position: relative;
padding-bottom: 56.25%; /* 16:9 */
padding-top: 25px;
height: 0;
}
.twitchWrapper iframe {
position: absolute;
top: 0;
left: 0;
width: 70%;
height: 70%;
}
.chatWrapper {
position: top;
padding-bottom: 56.25%; /* 16:9 */
padding-top: 50px;
height: 0;
}
.chatWrapper iframe {
position: top;
top: 25;
right: 8;
width: 29.5%;
height: 35%;
}
</style>
<div class="twitchWrapper">
<div class="twitch">
<iframe frameborder="0" scrolling="no" src="http://www.twitch.tv/Sykikal/embed"></iframe>
</div>
</div>
<div class="chatWrapper">
<div class="chat">
<iframe frameborder="0" scrolling="no" src="http://www.videogameinfo.net/forums/chat/popup"></iframe>
</div>
</div>
There's just two problems.. The chat appears too high up, it isn't aligned with the streaming page. http://videogameinfo.net/forums/pages/stream/
The other problem is that there's too much empty space down at the bottom. I tried changing the chat wrapper to adjust the position, but even changing it to a 1 or something throws it way off and moves it too far down to the bottom. Hoping someone can help.

You have issue because you have not proper HTML structure.
The below space is because you give lots of padding to chatwrapper class and chat class.
Just remove padding-bottom: 56.25%; from both class will remove your extra space.
And another issue: The chat appears too high up because you give iframe position:absolute; and it's top is 0. Change it to more approximately 300px;. like:
.chat iframe {
position: absolute;
right: 0;
top: 300px;
}
Hope it helps.

Related

Iframe - Problems with centering

I have some problems with an iframe centering.
The code is setup to keep the same ratio, so it is 100% reposonsive.
This also causes VERY LIMITED possibilies for adding formattiong and - Centering
I have tired to both add a container box, and changing the css styling but I cant seam to get it to work...
any idears
<div class="background background_video">
<div id="video_container">
<div class="youtube-video-container">
<iframe class="youtube-video" src="https://www.youtube.com/embed/8aGhZQkoFbQ"></iframe>
</div>
</div>
</div>
.youtube-video-container {
padding-top: 56.25%;
height: 0px;
position: relative;
}
.youtube-video {
width: 60%;
height: 60%;
position: absolute;
top: 0;
left: 0;
border: 0;
}
.youtube-video-container {
height: 300px; // some height
position: relative;
}
.youtube-video {
width: 60%;
height: 60%;
position: absolute;
bottom: 0;
left: 0;
border: 0;
display: block;
}
as I correct understand question
FROM ANOTHER POST I FOUND...
Thanks for the trying to help anyways guys!
Without knowing the width/height of the positioned1 element, it is still possible to align it as follows:
EXAMPLE HERE
.child {
position: absolute;
top: 50%; /* position the top edge of the element at the middle of the parent */
left: 50%; /* position the left edge of the element at the middle of the parent */
transform: translate(-50%, -50%); /* This is a shorthand of
translateX(-50%) and translateY(-50%) */
}
It's worth noting that CSS Transform is supported in IE9 and above. (Vendor prefixes omitted
In this responsive 16:9 youtube css, all parents of #video_container have to be set to an height 100%.
Click on Run code, then 'Full page' to see the result.
html, body {
height: 100%;
margin: 0;
}
.background_video {
height: 100%;
display: flex;
}
#video_container {
width: 60%;
margin: auto;
}
.youtube-video-container {
position: relative;
display: block;
width: 100%;
padding: 0;
overflow: hidden;
}
.youtube-video-container::before {
display: block;
content: "";
padding-top: 56.25%;
}
.youtube-video-container iframe {
position: absolute;
top: 0; bottom: 0; left: 0;
width: 100%;
height: 100%;
border: 0;
}
<div class="background background_video">
<div id="video_container">
<div class="youtube-video-container">
<iframe class="youtube-video" src="https://www.youtube.com/embed/8aGhZQkoFbQ"></iframe>
</div>
</div>
</div>

Why is my iframe overflow scroll not working in iOS?

I write this code in my HTML and CSS, it's working flawlessly in Android devices but NOT IN iOS. Can anyone help me with my code?
HTML
<ion-content overflow-scroll="true">
<div>
<iframe src="https://linkhere.com"
allowfullscreen SameSite="None" secure></iframe>
</div>
CSS
.iframe-container {
overflow: hidden;
padding-top: 500%;
position: relative;
}
.iframe-container iframe {
border: 0;
height: 100%;
left: 0;
position: absolute;
top: 0;
width: 100%;
}
/* 4x3 Aspect Ratio */
.iframe-container-4x3 {
padding-top: 75%;
}
.iframe-error iframe {
border: 0;
height: 0%;
left: 0;
position: absolute;
top: 0;
width: 0%;
}
Issue: Cannot scroll in iframe in iPhone and Unable to display properly in iPhone
Feel free to correct me. Thanks in advance!

Embed youtube video height issue

I'm trying to embed a youtube video into my project, it works and I also tried to apply a 16:9 ratio with padding-bottom: 56.25% like as most tutorials out there.
The issue is, the height of video is happened to be 100% of the container, What should I fix in my CSS to get rid of the top/bottom blackbar?
Here's my code pen attemp: https://codepen.io/DieByMacro/pen/QXmJez
.HomePage-homeVideoWrapper-274 {
height: 0;
margin: auto;
z-index: 1;
position: relative;
max-width: 720px;
padding-top: 25px;
padding-bottom: 56.25%;
}
.HomePage-homeVideoWrapper-274 iframe {
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 5;
position: absolute;
}
<div class="HomePage-homeVideoWrapper-274">
<iframe height="auto" src="https://www.youtube.com/embed/Qjmp2r2OsZ4" title="Home-admin tutorial" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"></iframe>
</div>
This is very common problem which we are facing while we add a videos on our template.You just need to add max-width and width property on OUTER div not at HomePage-homeVideoWrapper-274. No need to added max-height in HomePage-homeVideoWrapper-274.
.outer {
width: 100%;
max-width: 750px;
margin: 0 auto;
}
.HomePage-homeVideoWrapper-274 {
height: 0;
margin: auto;
z-index: 1;
position: relative;
padding-top: 25px;
padding-bottom: 56.25%;
display: block;
overflow: hidden;
iframe {
display: block;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 5;
position: absolute;
}
}
<div class="outer">
<div class="HomePage-homeVideoWrapper-274">
<iframe src="https://www.youtube.com/embed/Qjmp2r2OsZ4" title="Home-admin tutorial"></iframe>
</div>
</div>
Demo

Html page is not showing full in mobile view

I need Help, as my html page is showing only half height in Mobile page view. in browser it looks ok but in mobile view only half a page is being displayed.
div.container {
width: 100%;
border: 1px solid gray;
}
a {
color: white;
text-decoration: none;
}
.adds {
position: relative;
overflow: hidden;
}
.fluidMedia {
position: relative;
padding-bottom: 56.25%; /* proportion value to aspect ratio 16:9 (9 / 16 = 0.5625 or 56.25%) */
padding-top: 30px;
height: 0;
overflow: hidden;
}
.fluidMedia iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
header, footer {
padding: 1em;
color: white;
background-color: black;
clear: left;
text-align: center;
color: white;
text-decoration: none;
}
sidebar {
margin-left: 0px;
padding: 1em;
overflow: hidden;
}
<div class="container">
<header>
<h1>Income Tax Act 1961</h1>
</header>
<sidebar>
<div class="fluidMedia">
<iframe src="http://www.incometaxact1961.com/Income_Tax/Sections/section2.html" frameborder="0"> </iframe>
</div>
</sidebar>
<footer>Copyright © <a href="http://www.incometaxact1961.com/" >Incometaxact1961.com</a></footer>
I just need post to display full in mobile and web page.
Any help code will be highly appreciated, I need to load a html page in another html page.
If the enough content does not reach the device's height,it will come like this, You can fix this by two ways.
Set a min-height for the sidebar or make the footer sticky to the bottom of the container.
Setting minimum height will vary for different devices.So you need a sticky footer for this case.It is possible in CSS3 using flex layout.Try the given code.
html,body{
height: 100%;
}
.container{
display: flex;
flex-direction: column;
height: 100%;
}
header{
flex: 0 0 auto;
}
sidebar{
flex: 1 0 auto;
}
footer{
flex:0 0 auto;
}
It will act as sticky footer whenever your content on the page cannot fits the device height.
What you could do is giving your footer position: absolute; to make it stick to the bottom, like so:
div.container {
width: 100%;
border: 1px solid gray;
}
a {
color: white;
text-decoration: none;
}
.adds {
position: relative;
overflow: hidden;
}
.fluidMedia {
position: relative;
padding-bottom: 56.25%; /* proportion value to aspect ratio 16:9 (9 / 16 = 0.5625 or 56.25%) */
padding-top: 30px;
height: 0;
overflow: hidden;
}
.fluidMedia iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
header, footer {
padding: 1em;
color: white;
background-color: black;
clear: left;
text-align: center;
color: white;
text-decoration: none;
}
sidebar {
margin-left: 0px;
padding: 1em;
overflow: hidden;
}
footer {
position: absolute;
width: 100%;
bottom: 0;
}
<div class="container">
<header>
<h1>Income Tax Act 1961</h1>
</header>
<sidebar>
<div class="fluidMedia">
<iframe src="http://www.incometaxact1961.com/Income_Tax/Sections/section2.html" frameborder="0"> </iframe>
</div>
</sidebar>
<footer>Copyright © <a href="http://www.incometaxact1961.com/" >Incometaxact1961.com</a></footer>
You can try setting initial scale of viewport to 1 by inserting this meta to html head
<meta name="viewport" content="width=device-width, initial-scale=1.0">
In order to fix your issue yo do not need to add any extra code or CSS properties. Instead, you have to delete a few, in particular, remove these:
.fluidMedia {
position: relative;
padding-bottom: 56.25%;
padding-top: 30px;
height: 0;
overflow: hidden;
}
.fluidMedia iframe {
position: absolute;
top: 0;
left: 0;
}
Please, note that I said REMOVE these, not that your CSS should keep them. So this section of your CSS will look like:
.fluidMedia {
/* You can remove this, since it is empty. I added it for clarity purposes */
}
//This is what is left of the iframe CSS properties
.fluidMedia iframe {
width: 100%;
height: 100%;
}
I really hope this helps!

Responsive iframe, how to remove overflow border

I'm trying to embed a video using an iframe but I'm getting some annoying overflow padding that I can't seem to get rid of.
The code at the top is a way of forcing an iframe into a responsive style so that you can view it on mobile.
Basically the 'padding-bottom' code is controlling the aspect ratio of the frame.
I got the code from here:
https://www.smashingmagazine.com/2014/02/making-embedded-content-work-in-responsive-design/
I've checked here: Making responsive iframe and this leaves me with horrible overflow too.
The result is below:
Image displaying overflow issue
.video-container {
position: relative;
padding-bottom: 56.25%;
padding-top: 0px;
padding-right: 0px;
height: 0;
overflow: hidden;
}
.video-container iframe {
position: absolute;
top: 0;
bottom: 0;
left: 0px;
right: 0px;
width: 100%;
height: 100%;
}
</style>
<div class="video-container">
<iframe scrolling="no" src="https://06-lvl3-pdl.vimeocdn.com/01/4345/3/96727205/257828362.mp4?expires=1497358367&token=0ef4c2c1316f5f76d532a" frameBorder="0"></iframe>
</div>
Changing the padding-bottom: to 56.35% just moves the black overflow line to the bottom of the video instead of the side.
height 100vh will take 100% of viewport and margin:0 and padding:0 remove default properties.
Just add
.video-container {
position: relative;
}
.video-container iframe {
position: absolute;
top: 0;
left: 0px;
width: 100%; /* Add this */
height: 100vh; /* Add this */
padding:0px; /* Add this */
margin:0px; /* Add this */
}
.video-container {
position: relative;
}
.video-container iframe {
position: absolute;
top: 0;
left: 0px;
width: 100%;
height: 100vh;
padding:0px;
margin:0px;
}
<div class="video-container">
<iframe scrolling="no" src="https://06-lvl3-pdl.vimeocdn.com/01/4345/3/96727205/257828362.mp4?expires=1497358367&token=0ef4c2c1316f5f76d532a" frameBorder="0"></iframe>
</div>
I just did this instead. It works - gets around the user agent style sheet that Chrome uses and applies correct styling.
<style type="text/css">
.video-container {
position: relative;
padding-bottom: 56.25%;
padding-top: 0px;
padding-right: 0px;
height: 0;
border: 0;
overflow: hidden;
}
</style>
<div class="video-container">
<video style="width:100%;" src="https://06-lvl3-pdl.vimeocdn.com/01/4345/3/96727205/257828362.mp4?expires=1497358367&token=0ef4c2c1316f5f76d532a" controls autoplay type="video/mp4"></video>
</div>
position: relative;
padding-bottom: 56.25%;
padding-top: 0px;
padding-right: 0px;
height: 0;
overflow: hidden;
}
.video-container iframe {
position: absolute;
top: 0;
bottom: 0;
left: 0px;
right: 0px;
width: 100%;
height: 100%;
}
</style>
<div class="video-container">
<iframe scrolling="no" src="https://06-lvl3-pdl.vimeocdn.com/01/4345/3/96727205/257828362.mp4?expires=1497358367&token=0ef4c2c1316f5f76d532a" frameBorder="0"></iframe>
</div>