行高会影响图像吗? [英] Line-height affects images?

查看:117
本文介绍了行高会影响图像吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

http://jsfiddle.net/xJmZt/

As你可以看到在上面的例子中,在 div 上有额外的高度约6px。

As you can see in the above example , there is extra height of about 6px on the div.

如果line-height改为〜1px,额外的高度将会消失(链接)。

That extra height is gone if line-height is changed to ~1px (link).

因此,line-height会影响图片吗?

So line-height affects images too ?

推荐答案

默认值定义为内联元素,因此它们遵循文本规则,您可以设置容器高度以匹配图像,或者将图像 display:block vertical-align:bottom

Images by default are defined as inline elements so they follow text rules, you can either set the container height to match the images', or give the image display: block or vertical-align: bottom.

这篇关于行高会影响图像吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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