Iframe Center Align (Horizontal)
4 posters
Page 1 of 1
Iframe Center Align (Horizontal)
So, I'm trying to center my iframe and every tutorial I've looked up so far hasn't worked. I know it sounds stupid that I can't do it, but I'm having trouble with it Here's the code I have:
- Code:
<style>
iframe{
align: center !important;
position: center !important;
}
</style>
<iframe src="http://apps.pixlr.com/editor/" width="1500" height="600" frameborder="0" ></iframe>
Last edited by FineryWorkshop on February 15th 2015, 12:34 am; edited 1 time in total
Re: Iframe Center Align (Horizontal)
Yes, still no difference_Twisted_Mods_ wrote:have u tried wrapping the iframe with <center> </center> tags
Re: Iframe Center Align (Horizontal)
- Code:
<center><iframe src="http://apps.pixlr.com/editor/" width="1500" height="600" frameborder="0" ></iframe></center>
Lost Founder's Password |Forum's Utilities |Report a Forum |General Rules |FAQ |Tricks & Tips
You need one post to send a PM.
You need one post to send a PM.
When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
Re: Iframe Center Align (Horizontal)
If you want to center an element with CSS use margin:0 auto; or margin:auto;
( note : that the element should be block-level )
Now if you wanted to center the content inside another element, you can use text-align:center;
HTML :
and CSS :
( note : that the element should be block-level )
- Code:
iframe {
margin:0 auto;
display:block;
}
Now if you wanted to center the content inside another element, you can use text-align:center;
HTML :
- Code:
<div class="center">
<iframe src="/null"></iframe>
</div>
and CSS :
- Code:
.center { text-align:center }
Re: Iframe Center Align (Horizontal)
Thank you all so much all your help. I figured out the problem. (At least I think, it works now.) I made the width too long for the link so it just didn't carry on and so when I centered it it was centering the iframe not the link
And here's the code I ended up with for future viewers (?)
And here's the code I ended up with for future viewers (?)
- Code:
<style>
.center {
text-align:center;
width:100%;
}
iframe{
width: 1000px;
}
</style>
<div class="center">
<iframe style="align: center;" src="http://apps.pixlr.com/editor/" width="1500" height="600" frameborder="0"></iframe>
</div>
Re: Iframe Center Align (Horizontal)
You're welcome, that will work fine.
By default the <div> element should span the entire width of its parent container, -- similar to 100% width -- because it's a block-level element. This gives a pretty good explanation on block-level and inline elements.
By default the <div> element should span the entire width of its parent container, -- similar to 100% width -- because it's a block-level element. This gives a pretty good explanation on block-level and inline elements.
Similar topics
» Iframe code not work
» Align center text automatically
» Center block is off center
» iframe using javascript?
» Iframe Chat Box
» Align center text automatically
» Center block is off center
» iframe using javascript?
» Iframe Chat Box
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum