Il existe une bibliothèque pratique appelée play-bootstrap, alors utilisez-la.
play 2.5.10 java
build.sbt
Ajoutez " com.adrianhurt "%%" play-bootstrap "%" 1.2-P25-B3-RC2 "
«P25-B3» signifie utiliser bootstrap3 de la série play2.5
libraryDependencies ++= Seq(
...
"com.adrianhurt" %% "play-bootstrap" % "1.2-P25-B3-RC2"
)
app/views/main.scala.html
Ajoutez <link href =" //netdna.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css "rel =" stylesheet ">
au code HTML principal
<!DOCTYPE html>
<html lang="en">
<head>
@* Here's where we render the page title `String`. *@
<title>@title</title>
<link rel="stylesheet" media="screen" href="@routes.Assets.versioned("stylesheets/main.css")">
<link href="//netdna.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet">
<link rel="shortcut icon" type="image/png" href="@routes.Assets.versioned("images/favicon.png ")">
<script src="@routes.Assets.versioned("javascripts/hello.js")" type="text/javascript"></script>
</head>
<body>
@* And here's where we render the `Html` object containing
* the page content. *@
@content
</body>
</html>
app/views/index.scala.html
@(message: String)
@import b3.vertical.fieldConstructor
@main("index") {
@b3.buttonType("submit", 'class -> "btn btn-default"){ <span class="glyphicon glyphicon-ok"></span> Login }
}
Recommended Posts