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
  • 14,036
  • 36
  • 119
  • 198

1 Answers1

10

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

Niet the Dark Absol
  • 320,036
  • 81
  • 464
  • 592