如何设置img标签垂直中心:html + css [英] How to set img tag vertical center : html + css

查看:162
本文介绍了如何设置img标签垂直中心:html + css的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编码

<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;
}

水平方向的居中良好。
但是垂直不是。
如何做呢?
顺便说一句,example2.gif的高度不同于example1.gif

The centering of the horizontal direction do well. but vertical is not. How to do it? By the way, the height of example2.gif is different from example1.gif

推荐答案

本文可能有帮助 - - http://www.brunildo.org/test/img_center.html 必要性,它涉及到一个对于下载IE的一个黑客。

This article may help -- http://www.brunildo.org/test/img_center.html Of necessity, it involves a bit of a hack for down-version IE.

这篇关于如何设置img标签垂直中心:html + css的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆