Gif Picture Not Able To Align? - html

Right now I am working with an iFrame for HTML and I am trying to center align this image. When I type in align = "middle" it doesn't seem to work. I wan to place this GIF in a website. Aligning it in the center would make it look nice.
<iframe src="http://gifyoutube.com/embed/mG9rRw" frameborder="0" scrolling="no" width='480' height='270' style="-webkit-backface-visibility: hidden;-webkit-transform: scale(1);" ></iframe>

That is not a GIF. That is a video (either MP4 or WebM (depending on your browser)) which is embedded in the iframe. It's so small and could easily be converted into a GIF, but that's not the question here.
Add this CSS to your iframe and it should align it in the middle horizontally.
display: block;
margin: 0 auto;
http://jsfiddle.net/odezpjLy/
Check out the JSFiddle above for an example.

Place it in a div wrapper, and center the item in the <div>:
#wrapper
{
text-align:center;
width:100%;
}
<div id="wrapper">
<iframe src="http://gifyoutube.com/embed/mG9rRw" frameborder="0" scrolling="no" width='480' height='270' style="-webkit-backface-visibility: hidden;-webkit-transform: scale(1);" ></iframe>
</div>

Related

Embed an html web-page inside another one and scroll it using the parent scollbar

I would like to have the contents of an html webpage displayed in another (parent) html webpage, stretch the embedded webpage to the width of the parent and also remove the scroll bar of the embedded webpage while being able to scroll down the contents of the embedded webpage using the the scroll bar of the main page as the height of the embedded contents are too long to fit. I tried using code from answers to similar problems including this:
<iframe style='overflow:hidden; width:100%; height:100%' scrolling = "no" src="annotated list of courses.html" frameborder="0" width="100%" height="100%"> </iframe>
but I cannot achieve the desired outcome. I would like is to be able to scroll the contents of the embedded webpage using the scrollbar of the parent page. It is possible (with no need to copy code form the embedded HTML to the parent one instead) and how? Thanks.
I solved the problem by specifying a specific height for the embedded webpage which is greater than or equal to the height of the webpage like this:
<div id="content" class="content content-full" style="margin-top: -40px;">
<iframe style='overflow-y:hidden; width:100%; height:17560px' src="annotated list of courses.html" frameborder="0" width="100%" height="17560px" type="text/html"> </iframe>
</div>
I hope this can solve the problem also for others and any better or different slolution is also appreciated.
ps: You have to specify a height that is at least equal to the height of the contents of the embedded webpage or element for the scrollbar to disappear.
I've solved it by using two DIVs, one inside the other.
<div style="overflow-y: hidden; border: 2px solid black; width: 300px; height: 300px; position:absolute; left: 100px; top: 100px">
<div style="margin-top: -100px; width: 300px; height: 400px">
<iframe scrolling="no" style='pointer-events: none; width:100%; height: 100%' src="https://earth.nullschool.net/#current/wind/surface/level/orthographic=-325.19,32.21,3000/loc=35.073,31.923" frameborder="0" type="text/html"></iframe>
</div>
</div>
I've disabled The scrollbars by setting scrolling="no"
I've diasbled user clicks by setting style='pointer-events: none;'
Here is a working sample - https://jsfiddle.net/q46L1ynv/

align an embedded video in HTML

I am learning HTML and I'm creating a project using HTML. I embedded a youtube video and it shows up fine, but it's crossing the horizontal border below it and I was wondering if there was anyway to fix that. I tried aligning it to the top of the page, but that didn't work. Is there any inline CSS I can use?
Screenshot:
Code:
<iframe width="560" height="315" src="https://www.youtube.com/embed/rEUz-mBcGV8"
frameborder="0" allowfullscreen></iframe>
In your CSS you can use.
position: absolute;
bottom: ?px;
Play with the pixels in bottom to see how far up you want it to go.

Position and spacing with inline-block elements

I'm sure for most of you this is an easy one, however, I cannot seem to get my code to render correctly. I have three elements # 330px wide each, which I am trying to place "side by side" within a 1050px content area. Only one of the elements is rendering on the correct "block" with the other two appearing below. I am simply trying to place the three together spaced evenly across the content area with adequate space between them. Due to the fact that one element(rss feed) will only render on my site, please look at my test page to further explain what I am talking about: http://www.realtimehockey.net/testing.html
Thank you in advance for any help you may be able to offer.
My Code
CSS
.box {
display: inline-block;
float: left;
}
HTML
<div class="box">
<div class="feedgrabbr_widget" id="fgid_882d7000d9e4e2c5832cdb9c6"
float="right"></div>
<script> if (typeof(fg_widgets)==="undefined") fg_widgets = new
Array();fg_widgets.push("fgid_882d7000d9e4e2c5832cdb9c6");</script>
<script src="http://www.feedgrabbr.com/widget/fgwidget.js"></script>
<iframe
src="https://scorestream.com/widgets/iframe?widgetId=16476"
style="padding:0px;border:0px;width:330px;height:600px;max-height:600px;
display:inline-block"
title="Realtime sports scoreboard widget"
scrolling="no" frameBorder="0">
</iframe>
<iframe src="//www.facebook.com/plugins/likebox.php?href=https%3A%2F
%2Fwww.facebook.com%2Frealtimehockey&width=330&height=600&
amp;colorscheme=dark&show_faces=false&header=false&
amp;stream=true&show_border=true" scrolling="no" frameborder="0"
style="border:none; overflow:hidden; display:inline-block; width:330px;
height:600px;" allowTransparency="true"></iframe>
</div>
Add this to your CSS
.feedgrabbr_widget {
width: 330px;
display: inline-block;
}
This should correct the width and display for the first box which was actually rendering as a block element with a width of 663px from the chrome inspector.

How to reposition content in no scroll iframe?

I have an iframe for a google chart which has too much spacing around it. I want to embed this in my page but crop it to get rid of the surrounding space.
I was trying to do this by setting the iframe with smaller height and width attributes but I cannot work out how to reposition the content within the iframe to center it.
Here is the iframe for the chart:
<iframe width="550" height="170" seamless frameborder="0" scrolling="no" src="https://docs.google.com/spreadsheets/d/1r56MJc7DVUVSkQ-cYdonqdSGXh5x8nRum4dIGMN89j0/pubchart?oid=1407844401&format=interactive" onload="window.frames['itunes'].scrollTo(250,250)">></iframe>
How do you reposition the content of an iframe in this way or is there a better solution?
Thanks
You should wrap the iframe in a div or something and position the iframe.
here the code:
<div class="wrapper">
<iframe></iframe>
</div>
and this is the css
.wrapper{overflow:hidden;}
.wrapper iframe{position:relative; left:-40px; top:-30px;}

scrolling a div with youtube video under another div

I have my HTML as below
<html>
<body>
<div id="d1"
style="height:100px;width:100%;background-color:#CFE;position:fixed;z-index:1000">
</div>
<div id="d2" style="padding-top:110px;z-index:-1000;background-color:#CCE;height:1000px;">
<iframe width="420" height="315"
src="http://www.youtube.com/embed/XZxo7IznQnk" frameborder="0" allowfullscreen></iframe>
</div>
</body>
</html>
Top div (d1) is fixed. while scrolling bottom div(d2) goes behind top div. But youtube video
stay on top.
I want to put it behind top div. Is there a way??
The problem could be that the iframe is holding the flash youtube video on top. It has to do with the z-index of a Flash object.
I've used this solution before with success...
http://manisheriar.com/blog/flash_objects_and_z_index
Put your Flash content into a wrapper div called flash
Add to your object tag
Add wmode="transparent" into the embed tag
Use CSS to set the position and z-index for your div (don't set negative z-index values as it will hide your Flash)
Use this css:
#flash {
position: relative; /*or absolute*/
z-index: 0;
}
Edit: you would have to remove the Iframe. Wich would of bin a good idea in the first place, since iframes suck :p
That's because ActiveX objects tend to sit on top of ALL html elements. You'll have to have to add a "windowless" mode to your
<object>
<param name="wmode" value="window" />
</object>
Here is how I solved it.
<html>
<body>
<div id="d1"
style="height:100px;width:100%;background-color:#CFE;position:fixed;z-index:1000">
</div>
<div id="d2" style="padding-top:110px;z-index:-1000;background-color:#CCE;height:1000px;">
<iframe width="420" height="315"
src="http://www.youtube.com/embed/XZxo7IznQnk?wmode=transparent"
frameborder="0" allowfullscreen></iframe>
</div>
</body>
</html>
Note ?wmode=transparent" in src of iframe
What I tried when I came across similar situation:
#bridgeDIV
{
position:relative;
}
#riverDIV
{
position:fixed;
overflow-y:scroll;
}
Imagine river flowing under the bridge.