Navigations
Navbar
Right Aligned Links
To right align your navbar links, just add a right
class to your <ul>
that contains them.
<nav>
<div class="nav-wrapper">
<a href="#" class="brand-logo left">LOGO</a>
<ul id="nav-mobile" class="right hide-on-med-and-down">
<li><a href="sass.html">Sass</a></li>
<li><a href="ui-badges.html">Components</a></li>
<li><a href="js-collapsible.html">JavaScript</a></li>
</ul>
</div>
</nav>
Left Aligned Links
To left align your navbar links, just add a left
class to your <ul>
that contains them.
<nav>
<div class="nav-wrapper">
<a href="#" class="brand-logo right">LOGO</a>
<ul id="nav-mobile" class="left hide-on-med-and-down">
<li><a href="sass.html">Sass</a></li>
<li><a href="ui-badges.html">Components</a></li>
<li><a href="js-collapsible.html">JavaScript</a></li>
</ul>
</div>
</nav>
Centering the logo
The logo will center itself on medium and down screens, but if you want the logo to always be centered, add the center
class to your <a class="brand-title">
. You will have to make sure yourself that links do not overlap if you use this.
<nav>
<div class="nav-wrapper">
<a href="#" class="brand-logo center">LOGO</a>
<ul id="nav-mobile" class="left hide-on-med-and-down">
<li><a href="sass.html">Sass</a></li>
<li><a href="ui-badges.html">Components</a></li>
<li><a href="js-collapsible.html">JavaScript</a></li>
</ul>
</div>
</nav>
Active Items
Add active class to your li tags to denote the current page.
<div class="navbar-fixed">
<nav>
<div class="nav-wrapper">
<a href="#!" class="brand-logo center">LOGO</a>
<ul class="right hide-on-med-and-down">
<li><a href="sass.html">Sass</a></li>
<li><a href="ui-badges.html">Components</a></li>
<li class="active"><a href="js-collapsible.html">JavaScript</a></li>
</ul>
</div>
</nav>
</div>
Icon Links
You can add icons into links. For icon only links you don't need any additional class. Just pop the i
tag in and it will work.
<nav>
<div class="nav-wrapper">
<a href="#!" class="brand-logo left"><i class="material-icons">cloud</i>LOGO</a>
<ul class="right hide-on-med-and-down">
<li><a href="sass.html"><i class="material-icons">search</i></a></li>
<li><a href="ui-badges.html"><i class="material-icons">view_module</i></a></li>
<li><a href="js-collapsible.html"><i class="material-icons">refresh</i></a></li>
<li><a href="#!"><i class="material-icons">more_vert</i></a></li>
</ul>
</div>
</nav>
For adding an icon to a text link you need to add either a left
or right
class to the icon depending on where you want the icon to be.
<nav>
<div class="nav-wrapper">
<a href="#!" class="brand-logo left">LOGO</a>
<ul class="right hide-on-med-and-down">
<li><a href="sass.html"><i class="material-icons left">search</i>Link with Left Icon</a></li>
<li><a href="ui-badges.html"><i class="material-icons right">view_module</i>Link with Right Icon</a></li>
</ul>
</div>
</nav>
Search Bar
You can add a search form in the navbar.
<nav>
<div class="nav-wrapper">
<form>
<div class="input-field">
<input id="search" type="search" required>
<label for="search" class="label-icon"><i class="material-icons">search</i></label>
<i class="material-icons">close</i>
</div>
</form>
</div>
</nav>
Mobile Collapse Button
When your nav bar is resized, you will see that the links on the right turn into a hamburger icon menu. Take a look at the example below to get this functionality. Add the entire button-collapse
line to your nav
.
<nav>
<div class="nav-wrapper">
<a href="#!" class="brand-logo left">LOGO</a>
<a href="#" data-activates="mobile-demo2" class="button-collapse"><i class="material-icons">menu</i></a>
<ul class="right hide-on-med-and-down">
<li><a href="!#">Alex</a></li>
<li><a href="!#">Bianca</a></li>
<li><a href="!#">Carlos</a></li>
<li><a href="!#">Dorothy</a></li>
</ul>
<ul class="side-nav" id="mobile-demo2" style="padding-top:64px;">
<li><a href="!#">Alex</a></li>
<li><a href="!#">Bianca</a></li>
<li><a href="!#">Carlos</a></li>
<li><a href="!#">Dorothy</a></li>
</ul>
</div>
</nav>
Initialization
After including the button-collapse line into your navbar, all you have to do now is place this code in your page's $( document ).ready(function(){})
code. This example below assumes you have not modified the classes in the above example. In the case that you have, just change the jQuery selector in the line below to match it.
$(".button-collapse").sideNav();
Breadcrumbs
Breadcrumbs are a good way to display your current location. This is usually used when you have multiple layers of content.
<!-- Flat version -->
<nav class="flat">
<div class="nav-wrapper">
<div class="col s12">
<a href="#!" class="breadcrumb">First</a>
<a href="#!" class="breadcrumb">Second</a>
<a href="#!" class="breadcrumb">Third</a>
</div>
</div>
</nav>
<!-- By default in Navbar -->
<nav>
<div class="nav-wrapper">
<div class="col s12">
<a href="#!" class="breadcrumb">First</a>
<a href="#!" class="breadcrumb">Second</a>
<a href="#!" class="breadcrumb">Third</a>
</div>
</div>
</nav>
Pagination
Add pagination links to help split up your long content into shorter, easier to understand blocks.
<ul class="pagination">
<li class="disabled"><a href="#!"><i class="material-icons">chevron_left</i></a></li>
<li class="active"><a href="#!">1</a></li>
<li class="waves-effect"><a href="#!">2</a></li>
<li class="waves-effect"><a href="#!">3</a></li>
<li class="waves-effect"><a href="#!">4</a></li>
<li class="waves-effect"><a href="#!">5</a></li>
<li class="waves-effect"><a href="#!"><i class="material-icons">chevron_right</i></a></li>
</ul>
For more detailed informations please visit: http://materializecss.com/navbar.html | http://materializecss.com/breadcrumbs.html | http://materializecss.com/pagination.html