Iframe in wordpress

wordpress

(kerguelen) #1

Hi there,
I’ve build a little animation that I want to embed in a Wordpress article.
Here is the code I used :
iframe src=“http://site/index.html” width=“468” height=“465” style=“border:none;” frameborder=“0” scrolling=“no”>

Works nice in Chrome (but I wish this could be centered) but not in Safari.

any clue ?


#2

Can you share the URL where your iframe is placed?

To center an iframe, you can add margin: 0 auto; to the style section of your iframe. This will center it in the parent DIV:

<iframe src="http://site.com/document.html" height="250" width="250" style="display:block;margin:0 auto;border:none;" frameborder="0" scrolling="no"></iframe>


(kerguelen) #4

Hey Daniel,
Tried many things, but didn’t managed to center the animation on the page


#5

You will also need to add display:block; to your iframe’s inline CSS.


(kerguelen) #6

Thanks Daniel,
It works perfectly now !