如果用户在一行中发布了50个字符,我如何使用CSS确保在块中显示50个字符(宽度:100px;)。现在,我的观点如下。
<div class='example-wrapper'>
<%= simple_format(@user.content , class:'example') %>
</div>如果用户在@user.content中的一行中发布了50个字符(没有换行),它就会从浏览器中突出出来。我不是说我使用overflow:hidden;.Although,而是使用空白:normal;,没有什么变化。请告诉我怎么做。
现在,scss在下面。
.example-wrapper{
background-color:red;
max-width:100px;
}
.example{
max-width:100px;
white-space:normal;
}https://stackoverflow.com/questions/41316986
复制相似问题