The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Iframe Center Align (Horizontal)

View previous topic View next topic Go down

Solved Iframe Center Align (Horizontal)

Post by FineryWorkshop on Sat Feb 14 2015, 05:19

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>
I tried putting it in a table, and a ton of other things. But it just doesn't want to center Sad I also tried it as a simple HTML file off my website and it doesn't work, so it's not something on my website.


Last edited by FineryWorkshop on Sun Feb 15 2015, 01:34; edited 1 time in total
avatar
FineryWorkshop
Forumember

Female Posts : 48
Reputation : 1
Language : English
Location : USA

http://NOTREADY.forumotion.com

Back to top Go down

Solved Re: Iframe Center Align (Horizontal)

Post by _Twisted_Mods_ on Sat Feb 14 2015, 05:40

have u tried wrapping the iframe with <center> </center> tags
avatar
_Twisted_Mods_
Helper
Helper

Male Posts : 2064
Reputation : 314
Language : English
Location : Ms

http://liquidcode.forumotion.com

Back to top Go down

Solved Re: Iframe Center Align (Horizontal)

Post by FineryWorkshop on Sat Feb 14 2015, 06:19

_Twisted_Mods_ wrote:have u tried wrapping the iframe with <center> </center> tags
Yes, still no difference :/
avatar
FineryWorkshop
Forumember

Female Posts : 48
Reputation : 1
Language : English
Location : USA

http://NOTREADY.forumotion.com

Back to top Go down

Solved Re: Iframe Center Align (Horizontal)

Post by _Twisted_Mods_ on Sat Feb 14 2015, 06:27

well y im already on ur forum wheres this iframe located?
avatar
_Twisted_Mods_
Helper
Helper

Male Posts : 2064
Reputation : 314
Language : English
Location : Ms

http://liquidcode.forumotion.com

Back to top Go down

Solved Re: Iframe Center Align (Horizontal)

Post by SLGray on Sat Feb 14 2015, 10:27

Code:
<center><iframe src="http://apps.pixlr.com/editor/" width="1500" height="600" frameborder="0" ></iframe></center>


When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.

avatar
SLGray
Administrator
Administrator

Male Posts : 40448
Reputation : 2728
Language : English
Location : United States

https://fmthemes.forumotion.com/

Back to top Go down

Solved Re: Iframe Center Align (Horizontal)

Post by Ange Tuteur on Sat Feb 14 2015, 22:42

If you want to center an element with CSS use margin:0 auto; or margin:auto;
( 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 }
avatar
Ange Tuteur
Forumaster

Male Posts : 13176
Reputation : 2879
Language : EN10, FR5
Location : Macungie, PA

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Iframe Center Align (Horizontal)

Post by FineryWorkshop on Sun Feb 15 2015, 01:33

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 Smile

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>
avatar
FineryWorkshop
Forumember

Female Posts : 48
Reputation : 1
Language : English
Location : USA

http://NOTREADY.forumotion.com

Back to top Go down

Solved Re: Iframe Center Align (Horizontal)

Post by Ange Tuteur on Sun Feb 15 2015, 02:38

You're welcome, that will work fine. Wink

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. Smile
avatar
Ange Tuteur
Forumaster

Male Posts : 13176
Reputation : 2879
Language : EN10, FR5
Location : Macungie, PA

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Iframe Center Align (Horizontal)

Post by _Twisted_Mods_ on Sun Feb 15 2015, 05:13

Topic solved and archived
avatar
_Twisted_Mods_
Helper
Helper

Male Posts : 2064
Reputation : 314
Language : English
Location : Ms

http://liquidcode.forumotion.com

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum