javascript - Bootstrap 内联列表大量文本

标签 javascript jquery html css twitter-bootstrap

我知道 Bootstrap 有一个内置类“list-inline”。在我添加大量文本之前效果很好,然后我得到以下内容:

http://postimg.org/image/4ygjowp43/

我希望粉红色的 div 不包裹在绿色的 div 之下。我试过关于 stackoverflow 的另一篇文章:How to wrap lines in an inline-block with CSS?而且我无法让花车工作。

这是我的 HTML:

        <ul class="remove-bullet-list hanging">
            <li>
                <div class="description">
                    <b>Description: </b>
                </div>
                <div class="description-text">
                    Large amount of text. Large amount of text. Large amount of text. Large amount of text. Large amount of text. Large amount of text. Large amount of text. Large amount of text. Large amount of text. Large amount of text.
                </div>
            </li>
        </ul>

这是我的 CSS:

.description {
    background-color: green;
    overflow: hidden;
    float: left;
}

.description-text {
    background-color: pink;
    padding-left: 14px;
}

最佳答案

Fiddle:

好吧,根据您的要求,display:table 效果最好。

你的风格将是,

.description-text {
    background-color: pink;
    display: table-cell;
    padding-left: 14px;
    width: 100%;
}
.description {
    background-color: green;        
    overflow: hidden;
}
.remove-bullet-list li {
    display: table;
}

关于javascript - Bootstrap 内联列表大量文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25439620/

相关文章:

html - 如何沿顶部水平对齐这些 div?

javascript - 等到所有请求完成

javascript - docker 容器上解析服务器的自定义身份验证 (OAuth2)

javascript - Angular5 中的旋转木马

javascript - 是否可以在不重新加载的情况下运行注入(inject)的脚本?

jquery - 如何正确使用延时功能

HTML 页脚不会停留在页面底部

javascript - 动态更改 jQuery 选择器中的样式

javascript - 延迟 Javascript 悬停 Action

c# - 更新面板和 Anthem 如何在客户端隐藏方法名称