Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save runningdemo/40e7f2c47fd1fb5a0e4e to your computer and use it in GitHub Desktop.
Save runningdemo/40e7f2c47fd1fb5a0e4e to your computer and use it in GitHub Desktop.

问题描述

看栈爆网这个问答:Unwanted padding-bottom of a div

解决方法及解释

方法一:

img { display:block; }

Since images are inline and text is inline, user agents leave some space for descender characters ( y, q, g ) also called line-height.

方法二:

img {vertical-align: bottom}

方法三:(假设img的父元素是.imgParent)

.imgParent {line-height: 0}

line-height 属性继承自其父元素,所以要在其父元素上设置这个值就可以了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment