...

View Full Version : How to center iframe content



Miss Coucou
07-03-2011, 01:20 PM
I am building an image gallery for my new website, using tables and iframe.
I am satisfied with the result for horizontal images, but I would like to center the vertical images, which now appear to the left (see attached file) :(.

Here's the HTML code I used for the iframe:


<iframe name="frmPhotos" src="images/TestiFrame/wolf.jpg" frameborder="no" "" scrolling="no" width="100%"></iframe><br />


I tried adding the following code to the iframe line without success:
align="center"
style="float:center"


If you know the solution, thanks in advance for sharing! :)

N.B. The images used here are not mine. They are used for test purposes only.

gcmax
07-03-2011, 07:11 PM
You need to use margin:auto; to center non-textual elements.

I'm guessing your images are different sizes and there is a large gap on the first image so display might look strange. Since you are using javascript, it may be wise to seek out a lighbox gallery (http://www.lokeshdhakar.com/projects/lightbox2/) where all images are auto resized and have the same border.
Otherwise, try to make your photos the same size if possible.

vikram1vicky
07-04-2011, 12:57 PM
Use

margin:0 auto;to center align black elements

Cheers :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum