5

Possible Duplicate:
How do I vertically align text next to an image with CSS?

I am having trouble on aligning my texts and an image.

the texts and image are like

texts  ---------
      | image   |
       _________ 

I want the texts to be middle of the div instead of align to top.

I have:

<div id='test'> tests <img src='/images/logo.png'/> </div>

I have used the following css but still no luck

#test{
    margin-left: 10px;
    vertical-align: middle;
}

How do I align my text to the middle with image. Thanks so much!

Community
  • 1
  • 1
FlyingCat
  • 13,696
  • 36
  • 114
  • 188

1 Answers1

10

The vertical-align:middle should be on the image, not the container.

Niet the Dark Absol
  • 311,322
  • 76
  • 447
  • 566