【问题标题】:How to make alerts overlap?如何使警报重叠?
【发布时间】:2013-07-15 08:01:29
【问题描述】:
【问题讨论】:
标签:
jquery
css
twitter-bootstrap
【解决方案1】:
您可以将警报放在绝对定位的容器中,将它们从流中弹出:
.alerts {
position: absolute;
top: 30px;
left: 20px;
right: 20px;
}
<div class="main">
<h1>Heading</h1>
<p>
Some content here...
</p>
</div>
<!-- the order of elements is insignificant (you can swap the main
container and the alerts container and have the same result) -->
<div class="alerts">
<div class="alert">alerting...</div>
<div class="alert">alerting once more...</div>
</div>
这通过使用 Bootstrap 声明性组件(使用 CSS 挂钩)进行演示,但也可以使用 Bootstrap 命令式 API(通过 JavaScript 调用)。
这里有一个live demo on plunker 来说明这一点。