html - 溢出 Bootstrap 进度条的文本

标签 html css twitter-bootstrap twitter-bootstrap-3 progress-bar

这是我的 HTML:

<div class="progress">
    <div class="progress-bar progress-bar-warning progress-bar-striped first-bar" style="width:10%;">I want this text to overflow into the div to the right</div>
    <div class="progress-bar progress-bar-success second-bar" style="width:90%;">I want this text to overflow into the div to the left</div>
</div>
<div class="progress">
    <div class="progress-bar progress-bar-warning progress-bar-striped first-bar" style="width:90%;">I want this text to overflow into the div to the right</div>
    <div class="progress-bar progress-bar-success second-bar" style="width:10%;">I want this text to overflow into the div to the left</div>
</div>

这是我的 CSS:

@import url('//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-theme.min.css');
.first-bar {
    white-space: nowrap;
    position: relative;
    text-align: left;
}
.second-bar {
    white-space: nowrap;
    text-align: right;
    direction: rtl;
}

我想溢出每个 progress 类 div 中所有 div 元素的文本。 You can see in my Fiddle here我正在尝试做的是我的 CSS 用于将左侧 div 的文本溢出到右侧 div,而不是相反(右侧 div 的文本到左侧 div)。我怎样才能让它以相反的方式工作?我尝试在 second-bar 的 CSS 上添加 position: relative; 但这对我不起作用,因为它打破了第一个场景。

最佳答案

position: relative; 添加到宽度为 10% 的第二个栏的样式,允许文本保持在第一个进度栏上方。 JS Fiddle Here.我无法将其添加到实际的 second-bar CSS 类中,因为第一个栏不会溢出到第二个栏中。

关于html - 溢出 Bootstrap 进度条的文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32382746/

相关文章:

php - 如何知道点击了哪个按钮?

javascript - Polymer:如何观察 <content> 属性的变化

jquery - 具有行和编辑功能的引导模式

jquery - 如何为缩略图悬停添加标题 - Bootstrap?

html - 带有 Bootstrap 的 :hover does not work,

html - 按下按钮后如何更改按钮颜色?

css - 位置 : relative appearing over position:absolute

html - 表格在 Internet Explorer 中看起来很糟糕

javascript - 未捕获的类型错误 : Cannot set property 'className' of null

css - 在 bootstrap 中混合不同类型的列