Skip to content

[css] 第77天 请问display:inline-block在什么时候会显示间隙? #531

@haizhilin2013

Description

@haizhilin2013
Collaborator

第77天 请问display:inline-block在什么时候会显示间隙?

Activity

DBTXf

DBTXf commented on Jul 2, 2019

@DBTXf

在标签中会回车符,回车符相当于空白符,多个连续的空白符会合并成一个空白符,而产生“空白间隙”。

YeYongFen

YeYongFen commented on Jul 2, 2019

@YeYongFen

空白间隙

解决方法
1、全局font-size设置成0
2、

取消两个div之间的空格

hishuling

hishuling commented on Jul 2, 2019

@hishuling

空白间隙

解决方法
1、全局font-size设置成0
2、

取消两个div之间的空格

第二种方法需要在div上加上 vertical-align:bottom,消除底部间隙

yxkhaha

yxkhaha commented on Jul 2, 2019

@yxkhaha
  • display: inline-block 在IE67下会产生4px的空白间隙,原因是换行或空格会占据一定的位置。
  • 解决办法: 设置父元素的font-size: 0; letter-spaceing: -4px;
lookguy

lookguy commented on Jul 2, 2019

@lookguy

父元素的font-size没有设置为0或者继承了非零的根元素font-size的时候

smile-2008

smile-2008 commented on Jan 27, 2021

@smile-2008
  • display: inline-block 在IE67下会产生4px的空白间隙,原因是换行或空格会占据一定的位置。
  • 解决办法: 设置父元素的font-size: 0; letter-spaceing: -4px;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @smile-2008@haizhilin2013@DBTXf@hishuling@YeYongFen

        Issue actions

          [css] 第77天 请问display:inline-block在什么时候会显示间隙? · Issue #531 · haizlin/fe-interview