Vertical-align middle with display table-cell not working on images
问题 I'm trying to use the vertical-align: middle on a layout to vertically center sometimes text, sometimes images, but it's only working on text. Can anyone tell me why? HTML: <div> <img src="http://jsfiddle.net/img/logo.png"/> </div> <div> <span> text </span> </div> CSS: div{ width:200px; height:200px; background-color:red; display:table; margin:10px; } img, span{ display:table-cell; vertical-align:middle; } http://jsfiddle.net/9uD8M/ I created a fiddle aswell 回答1: Put border: 1px solid black