1

When putting a <img> in text, it seems to want the bottom of the image to be at the text baseline, or a little above, example:
example

How can I have it so the image's center is at the text's center? I know it can be done with CSS, however I forgot how.

amosrivera
  • 26,114
  • 9
  • 67
  • 76
James T
  • 3,292
  • 8
  • 40
  • 70
  • 1
    This is a duplicate question: http://stackoverflow.com/questions/489340/how-do-i-vertically-align-text-next-to-an-image-with-css – kasdega Jul 11 '11 at 15:47

3 Answers3

4

Using vertical-align: middle. E.g. http://jsfiddle.net/8QzFV/

newtron
  • 5,938
  • 1
  • 23
  • 19
0

Can you add padding to the top of the image?

#myImage
{
    padding-top:6px;
}
Dave
  • 3,812
  • 5
  • 31
  • 39
  • This is not a good way to try and solve this. It won't work for one and even if it did it isn't maintainable. – kasdega Jul 11 '11 at 15:54
  • @kasdega agreed this was my initial idea, I think @newtron answer is more suitable, i am voting it up. – Dave Jul 11 '11 at 16:03
  • agreed :) this question has been asked and answered here: http://stackoverflow.com/questions/489340/how-do-i-vertically-align-text-next-to-an-image-with-css – kasdega Jul 11 '11 at 16:09
0

just wrapp a div around it and use css style vertical-align:middle