2

How would I align my square image next to the menu text.

Fiddle

I tried

vertical-align: middle

but that doesn't seem to work.

user1938745
  • 193
  • 2
  • 5
  • 16
  • possible duplicate of [How do I vertically align text next to an image with CSS?](http://stackoverflow.com/questions/489340/how-do-i-vertically-align-text-next-to-an-image-with-css) – Sébastien Oct 02 '13 at 21:07

2 Answers2

3

You have to add vertical-align:middle to the img itself as opposed to the li.

CSS

#cssmenu ul li img {
    vertical-align: middle;
}

Working - jsFiddle here

Josh Crozier
  • 233,099
  • 56
  • 391
  • 304
2

Just add vertical-align: middle; to the IMG tag. Works for me.

<li class='active'>
  <a href='#'>
    <img src="http://upload.wikimedia.org/wikipedia/commons/5/55/Box_square.gif" 
      style="padding:10px; vertical-align: middle;" width="24" height="24">
    <span>Menu1</span>  
  </a>
</li>

Also, the height and width attributes don't need "px" units.

Larsenal
  • 49,878
  • 43
  • 152
  • 220