CSS - 文本和图像链接文本垂直对齐中间

问题描述:

请修改this example以向我展示如何让图像旁边的文本在图像中间旁边垂直对齐。CSS - 文本和图像链接文本垂直对齐中间

演示:http://jsfiddle.net/Blender/sVx5e/1/

HTML

<div onclick="window.location = '#'"> 
    <img src="http://doc.jsfiddle.net/_images/jsfiddle-logo-thumb1.png"> 
    jsFiddle 
</div> 

CSS

div { 
    height: 150px;  /* This is the height of the image */ 
    line-height: 150px; 
} 

img { 
    float: left; 
} 

使用<div>,而不是一个<a>元件,包装元件的块时。 IE呛起来,当你做...

+0

IE浏览器无法正常使用块'a'元素... – Blender 2011-05-02 18:14:11

+0

它在IE8中为我工作。您能否发布支持您的声明的源代码:“IE无法正常使用块”“元素。” – 2011-05-02 20:54:24