Découvez les bases du plus célébre des frameworks CSS.
<meta name="viewport" ...
<nav class="navbar navbar-default">
<div class="container-fluid">
<!-- Brand, toggle pour l'affichage en version mobile -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Brand</a>
</div>
<!-- Liens de navigation, formulaires et autres -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li class="active"><a href="#" title="Lien actif">Lien actif <span class="sr-only">(current)</span></a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Lien 2 <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#" title="Lien 2.1">Lien 2.1</a></li>
<li><a href="#" title="Lien 2.2">Lien 2.2</a></li>
<li><a href="#" title="Lien 2.3">Lien 2.3</a></li>
<li role="separator" class="divider"></li>
<li><a href="#" title="Lien séparé 1">Lien séparé 1</a></li>
<li role="separator" class="divider"></li>
<li><a href="#" title="Lien séparé 2">Lien séparé 2</a></li>
</ul>
</li>
</ul>
<form class="navbar-form navbar-left">
<div class="form-group">
<input type="text" class="form-control" placeholder="Rechercher">
</div>
<button type="submit" class="btn btn-sm btn-default">OK</button>
</form>
<ul class="nav navbar-nav navbar-right">
<li><a href="#" title="Lien à droite">Lien à droite</a></li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="#">
<img alt="Marque" src="images/mini-bootstrap.png">
</a>
</div>
</div>
</nav>
<p class="navbar-text">Bonjour Miguel !, Déconnectez-vous</p>
.navbar-link
".navbar-left
" et ".navbar-right
".navbar-fixed-top
"
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container"> ... </div>
</nav>
body {padding-top: 70px;}
.navbar-fixed-bottom
" <nav class="navbar navbar-default navbar-fixed-bottom">
<div class="container"> ... </div>
</nav>
body {padding-bottom: 70px;}
.navbar-static-top
" <nav class="navbar navbar-default navbar-static-top">
<div class="container"> ... </div>
</nav>
.navbar-inverse
", votre menu de navigation sera sur fond noir avec les liens hypertextes en blanc.<nav class="navbar navbar-inverse"> ... </nav>