【发布时间】:2020-07-22 09:14:24
【问题描述】:
我的 CSS 网格有问题。
在 Firefox 中,当屏幕宽度减小(例如 600 像素)时,使用 CSS Grid 的页面上的某些元素不支持word-break 值。它们与原来保持在同一条线上。
我尝试添加display: inline-block,但没有解决这个问题。
这就是错误:
* {
box-sizing: border-box;
}
body {
margin: 0 0;
padding: 0 0;
}
.grid {
text-align: center;
align-items: center;
justify-content: center;
width: 100%;
display: grid;
margin-right: auto;
margin-left: auto;
}
.item {
grid-area: one;
display: grid;
}
<div class="grid">
<div class="item">
<p>Some looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong line</p>
<p>Some looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong line</p>
</div>
</div>
另一个例子:link
我必须或可以使用任何属性来解决这个问题吗?
【问题讨论】:
-
你的代码中的分词在哪里?
-
@Sfili_81
word-break: break-word是默认值
标签: css firefox word-break