不能摆脱我的子图像和父div之间的奇怪的2px空间 [英] Cannot get rid of a bizarre 2px space between my child image and parent div

查看:139
本文介绍了不能摆脱我的子图像和父div之间的奇怪的2px空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经尝试了我知道的一切。我开始认为它是由Tumblrs javascript创建。
首先,我有内联块,我知道读取空白和添加像素。但是经过多次测试,我的所有javascript,删除所有的东西,只留下一个标准

 < div>< img src =image/>< / div> 

我仍然在图片下方获得这个2px的空间!



所以我想知道有没有方法可以做到这一点没有jquery也许?

  .parentdiv {
height:100% - 2px;
}



解决方案

$ b $

  line-height:0; 



示例



http://jsfiddle.net/YGjpk/


I have tried everything I know. I'm beginning to think it's being created by Tumblrs javascript. First, I do have inline blocks, which i know read white space and add pixels. But after much testing, stripping all my javascript, and removing everything and leaving just a standard

<div><img src="image"/></div>

I still get this 2px space below the image!

So I'm wondering is there a way to do this without jquery perhaps?

.parentdiv {
    height:100% - 2px;
}

?

解决方案

This issue is caused by the line-height, because text is expected, too.

Solution

line-height: 0;

Sample

http://jsfiddle.net/YGjpk/

这篇关于不能摆脱我的子图像和父div之间的奇怪的2px空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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