Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jul 2011
    Location
    Montreal, Canada.
    Posts
    8
    Thanks
    3
    Thanked 0 Times in 0 Posts

    How to center iframe content

    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:

    Code:
    <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.
    Last edited by Miss Coucou; 11-03-2011 at 02:39 AM.

  • #2
    Regular Coder gcmax's Avatar
    Join Date
    Sep 2010
    Posts
    108
    Thanks
    8
    Thanked 5 Times in 5 Posts
    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 where all images are auto resized and have the same border.
    Otherwise, try to make your photos the same size if possible.

  • #3
    Regular Coder
    Join Date
    Jul 2011
    Location
    India
    Posts
    496
    Thanks
    3
    Thanked 57 Times in 56 Posts
    Use
    Code:
    margin:0 auto;
    to center align black elements

    Cheers


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •