为什么现代浏览器仍然在行内块之间放置空格,如果有空格 [英] why do modern browsers still put spaces between inline block if there is whitespace
问题描述
如果您有这样的标记:
<div class="inlineblock">one</div>
<div class="inlineblock">two</div>
<div class="inlineblock">three</div>
和css就像这样:
.inlineblock {display:inline-block; }
and css like this: .inlineblock{ display: inline-block; }
您将在元素之间获得空格。约4px的空间。除非您的标记如下所示:
You will get spaces between the elements. about 4px of space. unless your markup looks like this:
<div class="inlineblock">one</div><div class="inlineblock">two</div><div class="inlineblock">three</div>
现在,我想知道的是WHY?
Now, what i would like to know is WHY?
什么是好的浏览器仍然这样做的技术原因,即使最新的Firefox,Chrome和Opera在发布时仍然这样做。我假设有一个技术原因背后,否则它会被修复现在?
What is the technical reason that "good" browsers still do this, even the latest Firefox, Chrome, and Opera at the time of this posting still do this. I assume there is a technical reason behind it, otherwise it would have been fixed by now?
谢谢!
推荐答案
内联元素之间的空格与单词之间的空格没有区别。
Spaces between inline elements are no different from spaces between words.
如果你不想要的,使用块元素,或将字体大小设置为零。
If you don't want that, use block elements, or set the font size to zero.
这篇关于为什么现代浏览器仍然在行内块之间放置空格,如果有空格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!