vertical-align is set ?
Note: I set the line-height attribute of the span to be the same height as the div. However, the text in the red part (span) still cannot be centered vertically relative to the red part. Please Expert advice! Thank you very much!
<div id="divMain" style="width:100%;height:25px; border:solid 1px #000000; text-align:center;" ><span style="float: left;"><国家名称</span> <span class="spanChina" style="width:104px;background:#FF0000; padding-bottom:5px; margin-right:-2px;line-height:25px;" ><span style="vertical-align: middle;">中国</span></span> <span class="spanAmeran" style="width:104px;background:#FF0000;padding-bottom:5px; margin-left:-2px;line-height:25px;"><span style="vertical-align: middle;">美国</span></span> <span style="float:right;"><img id="imgClose" src="../../../img/closePage.png" /> </span></div>
...Add display:inline-block;vertical-align:middle;