Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

水平div + inline-block 之间的空白间隔 #10

Open
san3Xian opened this issue Jul 10, 2019 · 0 comments
Open

水平div + inline-block 之间的空白间隔 #10

san3Xian opened this issue Jul 10, 2019 · 0 comments
Labels

Comments

@san3Xian
Copy link
Owner

san3Xian commented Jul 10, 2019

经常间歇性失忆忘了具体解决方法(还是用得少
还是记录下来好了
图转自网友博客

现象

两个div设置为inline-block以后,中间有空白缝隙(margin:0;)
image

原因

两个div元素之间有空白代码(如换行/空格等)

解决方法

1

父元素设置font-size:0;
子元素记得改回来

2

元素直接不换行(一坨一坨的代码)

3

position:relative;
相对定位

参考文章

https://www.cnblogs.com/cuncunjun/p/7390623.html

@san3Xian san3Xian added the CSS label Jul 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant