jquery - 当这个 <p> 超过页面宽度时,如何防止它被剪掉?

标签 jquery html jquery-mobile

我正在使用 jQuery Mobile,我的一个页面出现问题。

我有一个 <p>像这样嵌入列表中:

<div data-role="page">

    <div data-role="header">
        <h1>Page 1</h1>
    </div>

    <div data-role="content">
        <ul data-role="listview">
            <li data-role="list-divider">
                List Heading
            </li>
            <li>
                <p>A very long paragraph that <b>should</b> be wrapped when it exceeds the length of the visible line.</p>
            </li>
        </ul>
    </div>

</div>

无论我做什么,页面看起来都是这样的:

enter image description here

<p>正在被剪裁。我尝试将它包装在 <div> 中, 但它保持不变。自 <p>是从外部来源提取的,我更喜欢不修改 <p> 的解决方案或其内容。

最佳答案

Jquery Mobile 应用以下内容:

text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;

如果您为 p 标签重写这些样式,您应该能够让它按您希望的方式换行。用这些样式覆盖:

text-overflow: ellipsis;
overflow: visible;
white-space: normal;

确保您的 css 足够具体,否则您的覆盖样式将不会被应用。

关于jquery - 当这个 <p> 超过页面宽度时,如何防止它被剪掉?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5799980/

相关文章:

javascript - Show more/Show less 在刷新时停留在页面上

javascript - 复制变量javascript

jquery - 为什么 jQuery 不是浏览器原生的,即预先下载的?

html - 当段落只有几个单词(少于整行)时显示格式不正确

css - 如何在 JQM data-role=mini 上保持相同的宽度?

jquery - 将鼠标悬停在 LI 上即可显示 div

html - 输入标记中用于指定密码长度的模式属性不起作用?

javascript - 如何获得一个复选框的div的结果?

jquery 加载器小部件未显示

javascript - JQuery mobile如何防止li项向右滑动?