相关疑难解决方法(0)

nowrap内联块之间的空间

我希望有几个块元素彼此相邻,它们采用完整的浏览器宽度.

有了white-space: nowrap它,它工作得很好,但在一个元素和另一个元素之间有一些像素的随机空间:

body { margin: 0; padding: 0; }
#container1 { white-space: nowrap; position: absolute; width: 100%; }
#container1 div { display: inline-block; width: 100%; height: 200px; }
Run Code Online (Sandbox Code Playgroud)
<div id="container1">
    <div style="background: red;"></div>
    <div style="background: yellow;"></div>
    <div style="background: green;"></div>
    <div style="background: blue;"></div>
</div>
Run Code Online (Sandbox Code Playgroud)

这是jsBin演示.

它没有填充,没有边距,没有边框,没有偏移.

html css

2
推荐指数
1
解决办法
5086
查看次数

标签 统计

css ×1

html ×1