这里的问题是,当我<span>
在一个标签中有多个元素<p>
并给它们<span>
一个 CSS 时inline-block
,末尾的空间<span>
被inline-block
.
有人可以解释为什么会发生这种行为吗?
.container {
width: 500px;
margin: auto;
font-size: 2em;
border: solid 1px red;
}
.merge {
white-space: nowrap;
display: inline-block;
}
<div class="container">
<p>Lorem ipsum dolor sit amet consectetur <span class="merge">adipisicing elit, </span><span class="merge">Provident, </span><span class="merge">amet, </span><span class="merge">facere, </span><span class="merge">modi itaque, </span><span class="merge">praesentium, </span><span class="merge">nihil quam? </span><span class="merge">Nostrum, </span><span class="merge">aut assumenda, </span><span class="merge">Doloribus vitae, </span><span class="merge">necessitatibus, </span><span class="merge">iusto, </span><span class="merge">debitis, </span><span class="merge">aliquam, </span><span class="merge">odit, </span><span class="merge">pariatur, </span><span class="merge">fuga, </span><span class="merge">mollitia, </span><span class="merge">magni, </span></p>
</div>