Html Bootstrap CSS bg-success 警报不起作用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22467967/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Bootstrap CSS bg-success alert not working
提问by chuckfinley
For some reason bg-danger class in Bootstrap 3 does not display red background. Why?
出于某种原因,Bootstrap 3 中的 bg-danger 类不显示红色背景。为什么?
<p class="bg-danger">There was an error updating your details.</p>
回答by martynas
In Bootstrap you have the following pre-defined backgrounds:
在 Bootstrap 中,您有以下预定义的背景:
Bootstrap 3.1.0:
引导程序 3.1.0:
<div class="bg-primary">...</div>
<div class="bg-success">...</div>
<div class="bg-info">...</div>
<div class="bg-warning">...</div>
<div class="bg-danger">...</div>
Bootstrap 3.0.3:
引导程序 3.0.3:
<div class="alert alert-success">...</div>
<div class="alert alert-info">...</div>
<div class="alert alert-warning">...</div>
<div class="alert alert-danger">...</div>
Bootstrap components
引导组件
回答by Aleksander Bavdaz
Contextual backgrounds bg-primary
, bg-success
, bg-info
, bg-warning
and bg-danger
were added to Bootstrap as of version 3.1.0 and were not present in 3.0.3 and before.
自 3.1.0 版起,上下文背景bg-primary
、bg-success
、和已添加到 Bootstrap 中,但在 3.0.3 及之前版本中不存在。bg-info
bg-warning
bg-danger
There have however been alert
s with the four contextual classes alert-success
, alert-info
, alert-warning
and alert-danger
which are suitable for that kind of error messages.
然而,已经有alert
s的四个上下文类alert-success
,alert-info
,alert-warning
和alert-danger
适合于那种错误信息。
<p class="alert alert-danger">There was an error updating your details.</p>
Also see the Bootstrap Alerts Component: http://getbootstrap.com/components/#alerts
另请参阅 Bootstrap 警报组件:http: //getbootstrap.com/components/#alerts
回答by felwithe
I just spent all day trying to figure out why alert-error
wasn't working, only to realize it's not alert-error, it's alert-danger. Leaving this here in case someone else tortures themselves for hours trying to figure out what's wrong with their Bootstrap 3 alert.
我只是花了一整天的时间试图找出为什么alert-error
不起作用,才意识到这不是警报错误,而是警报危险。留在这里以防其他人折磨自己几个小时试图找出他们的 Bootstrap 3 警报有什么问题。