Center image vertically and horizontally

Discussion in 'CSS' started by tyankee, Jun 6, 2012.

  1. #1
    i am having the hardest time centering an image in a div. Actually the coding is setup so that there is a table, broken into 3 columns and within each column are div statements. Don't ask me why they did this - it's Sunshop's script. But i can't get an image to center vertically in any column where the image is smaller than the other columns.

    i tried to get it to work by hard coding a fix height of the div but that didn't work. I've tried everything. it can be seen at http://www.crossstitchingart.com/shop/

    under the 'featured products', you can see 3 columns and the 3rd column in the first row is an image smaller than the first 2 columns and it only wants to align the image at the top. I've tried 'vertical-align:middle' and a number of other things but can't get it to center next relative to the other 2 images.. you can also see the problem in row 2.

    can anyone help me please.
     
    tyankee, Jun 6, 2012 IP
  2. MarkTheUser

    MarkTheUser Member

    Messages:
    206
    Likes Received:
    0
    Best Answers:
    4
    Trophy Points:
    26
    #2
    I dont understand.. the images are displayed as they should be for me. But you can use margins to move them where ever you want.

    margin-left margin-right margin-top and margin-bottom.
     
    MarkTheUser, Jun 8, 2012 IP
  3. tyankee

    tyankee Well-Known Member

    Messages:
    1,023
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    150
    #3
    i actually figure it out - that's why it looks right now.. the margin-left, etc did not work.
     
    tyankee, Jun 8, 2012 IP