css - Vertically align text next to an image? -


Why not vertical-aligned: middle will not work? And yet, vertical-align: top does work.

  & lt; Div & gt; & Lt; IMG style = "width: 30px; height: 30px" & gt; & Lt; Span style = "vertical-align: middle" & gt; Does not work & Lt; / Span & gt; & Lt; / Div & gt; In fact, in this case it is very easy: Apply vertical alignment of the image. Since it's all in one line, it's actually the image that you want to combine, not the text.  

  & lt ;! - Moved "vertical-align: img from style to spin from center -> gt; & lt; div & gt; & lt; img style =" vertical-alignment: center "src =" https://placehold.it/ 60x60 ">  & lt; / div & gt;  

Tested in FF3.


Comments