如何删除内联元素之间的空格的可见性? [英] How do I remove the visibility of spaces between inline elements?
问题描述
说我有几个inline-block div标签,例如
Say I have several inline-block div tags, like this
<div class="image">
</div>
<div class="image">
</div>
类图片只是将它们的大小设置为100x100和灰色背景颜色。
class image just sets their size to 100x100 and a gray background color. Their margin and borders are set to 0, and yet there is spacing between the two rectangles.
如果我写这样的HTML,则:
If I write the HTML such as this, however:
<div class="image">
</div><div class="image">
</div>
删除div之间的所有空格,间距消失。
Removing all whitespace between the divs, the spacing disappears.
由于我不想写这样的HTML,我认为必须有一种方法使用CSS删除空格。
Since I don't want to write my HTML like that, I'm thinking that there must be a way to remove whitespace using CSS. I don't care if the whitespace is removed, hidden or downsized as long as it's visibility is removed.
感谢任何帮助
根据要求,JSFiddle: http://jsfiddle.net/6h3Jx/
As requested, JSFiddle: http://jsfiddle.net/6h3Jx/
已更新为字间距: http://jsfiddle.net/6h3Jx/1/
推荐答案
它是一个内联元素行为,所以试试浮动左。 http://jsfiddle.net/aVrSx/
it is an inline element behaviour, so try floating left. http://jsfiddle.net/aVrSx/
这篇关于如何删除内联元素之间的空格的可见性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!