Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/90.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/40.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何设置img标签垂直中心:html+;css_Html_Css_Image - Fatal编程技术网

如何设置img标签垂直中心:html+;css

如何设置img标签垂直中心:html+;css,html,css,image,Html,Css,Image,我正在编码 <div> <a href="http://example1.com"> <img src="example1.gif" /> </a> </div> <div> <a href="http://example2.com"> <img src="example2.gif" /> </a> </div> a { text-align:cent

我正在编码

<div>
 <a href="http://example1.com">
   <img src="example1.gif" />
 </a>
</div>
<div>
 <a href="http://example2.com">
   <img src="example2.gif" />
 </a>
</div>

a {
  text-align:center;
  height :80px;
  display:block;
}

a{
文本对齐:居中;
高度:80px;
显示:块;
}
水平方向的居中效果良好。 但垂直方向并非如此。 怎么做?
顺便说一下,example2.gif的高度与example1.gif不同

您需要设置
垂直对齐:中间在您的
img
元素上