Very Simple Workaround个
正如@RokoC.Buljan在一条 comments 中指出的那样,这个问题似乎是Chromium漏洞.
简单的解决方法是在最后一个按钮后添加<wpr>
标签.这Line Break Opportunity基本上是一个空元素.然而,您也可以使用
不间断空间实体,它同样有效.
Test Snippet个
.buttons {
display: flex;
flex-wrap: wrap;
gap: 10px;
}
.button {
padding: 5px;
background-color: rgb(200, 200, 200);
}
<h4>1. Original without workaround</h4>
<div class="buttons">
<div class="button">
One
</div>
<div class="button">
Two
</div>
<div class="button" tabindex="0" contenteditable="true" spellcheck="false">
Three
</div>
</div>
<h4>2. Using a word-break opportunity tag</h4>
<div class="buttons">
<div class="button">
One
</div>
<div class="button">
Two
</div>
<div class="button" tabindex="0" contenteditable="true" spellcheck="false">
Three
</div>
<wbr>
</div>
<h4>3. Using a non-breaking space entity</h4>
<div class="buttons">
<div class="button">
One
</div>
<div class="button">
Two
</div>
<div class="button" tabindex="0" contenteditable="true" spellcheck="false">
Three
</div>
</div>