两个行内块< span>元件 [英] The gap between two inline-block <span> element

查看:158
本文介绍了两个行内块< span>元件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在html中创建了两个元素,并使每个元素都成为一个inline-block。我发现这两个元素之间总是有一个差距,但实际上我没有为它们设置任何填充/边距属性。

解决方案

CSS:

  span {
display:inline-block;
}

HTML:



p $ p> < span>这将有< / span>
< span>元素之间的间隙< / span>

< span>这不会在元素之间< / span>< span>间隙< / span>


I created two elements together in html and made each an inline-block. I found that there was always a gap between these two elements but actually I didn't set any padding/margin attibutes for them. Could someone tell me why and how I can fix this gap?

解决方案

CSS:

span {
  display: inline-block;
}

HTML:

<span>This will have</span>
<span>a gap between the elements</span>

<span>This won't have</span><span>a gap between the elements</span>

这篇关于两个行内块&lt; span&gt;元件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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