我尝试在登录失败或未提交输入时在我的登录表单中显示bootstrap(版本3.3.5)警报。这是我的login.scala.html
@(content: Html)(implicit messages: Messages,flash: play.api.mvc.Flash)
<!DOCTYPE html>
<html>
<head>
<title> @Messages("application.name")</title>
<script src="@routes.Assets.at("jquery/jquery.js")" type="text/javascript"></script>
<script src="@routes.Assets.at("bootstrap/js/bootstrap.min.js")" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" media="screen" href="@routes.Assets.at("stylesheets/bootstrap.min.css")">
<link rel="stylesheet" media="screen" href="@routes.Assets.at("stylesheets/main.css")"/>
<link rel="stylesheet" type="text/css" media="screen" href="@routes.Assets.at("stylesheets/login.css")">
</head>
<body>
<header class="topbar">
<h1 class="fill">
@Messages("application.name")
</h1>
</header>
<section id="main">
<center>
@if(flash.get("success").isDefined){
<div class="alert alert-success">
<strong>Success!</strong> @flash.get("success")
</div>
}
@if(flash.get("error").isDefined){
<div class="alert alert-error">
<strong>Error!</strong> @flash.get("error")
</div>
}
@content
</center>
</section>
</body>
</html>
鉴于路径是正确的,但我很困惑为什么这些css不仅适用于警报,请看这个快照
如果有人能给出解决方案,那么欣赏吧。谢谢
答案 0 :(得分:0)
Bootstrap中没有alert-error
,很可能你想使用alert-danger
。