简体   繁体   English

换行长字在引导流体容器中不起作用

[英]Word-Wrap on long words not working in bootstrap fluid containers

I have been using bootstrap to make my page mobile friendly. 我一直在使用引导程序来使页面移动友好。 My content is dynamically generated, so if someone puts a very long text (like lorem ipsum) it okay since i have a truncate, but i'm having problems with long words. 我的内容是动态生成的,因此,如果有人输入很长的文本(例如lorem ipsum),那没关系,因为我截断了文本,但是长字存在问题。

Heres the actual situation: Actual 这是实际情况: 实际

And this is how i wish it would look like: Intended 这就是我希望的样子: 预期的

I've tried the following solutions to no avail: 我尝试了以下解决方案,但无济于事:

I'm Using Bootstrap 3.3.2, Twig and Symfony. 我正在使用Bootstrap 3.3.2,Twig和Symfony。 Here's the code 这是代码

<tr class="row">
<td class="col-sm-12 clickable" data-toggle="modal" data-target="#myModal-{{pregunta.id}}">
    <div style="height:150px;overflow:hidden; text-overflow:ellipsis;">
        {{ pregunta.contenido|markdown|raw|truncate(150) }}
    </div>
</td>

And here is how its being rendered: 这是它的呈现方式:

<tr class="row">
<td class="col-sm-12 clickable" data-toggle="modal" data-target="#myModal-4">
    <div style="height:150px;overflow:hidden; text-overflow:ellipsis;">
        <p>PreguntaaaaaaaaaaaaaaaaLargaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaioooooooooooo</p>

    </div>
</td>

i've also added the property 我还添加了该属性

p{
word-wrap: break-word;}

To my css, and if i inspect the paragraph, it has it, also added the white-space: normal; 在我的css中,如果我检查了该段,也添加了空格:normal; and it didn't work 而且没有用

If you specify a width on the element, it should wrap itself without needing anything else. 如果您在元素上指定宽度,则它应该自行包装而无需其他任何东西。 Have you tried that? 你有尝试过吗? Also i think word-wrap only works if you specify the width 我也认为自动换行仅在您指定宽度时才有效

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM