Learn 'Mobile First' Web Design Using Bootstrap 3 by Rahul A. Sakla - HTML preview

PLEASE NOTE: This is an HTML preview only and some elements such as links or page numbers may be incorrect.
Download the book in PDF, ePub, Kindle for a complete version.

Chapter 13 Navbars

 

13.1 Default Navbar

Navbars are responsive meta components that serve as navigation headers for your application or site. They begin collapsed tand are toggleable) in mobile views and become horizontal as the available viewport width increases.

 

img4.pngJustified navbar nav links are currently not supported.

 

img260.png

img261.png

img262.png

img263.png

img264.png

 

img265.png

img266.png

img267.png

img268.png

img269.png

img270.png

img271.png

img272.png

img273.png

img274.png

img275.png

img276.png

img277.png

img278.png

 

13.2 Brand Image

Replace the navbar brand with your own image by swapping the text for an <img>. Since the .navbar-brand has its own padding and height, you may need to override some CSS depending on your image.

img279.png

 

13.3 Forms

Place form content within .navbar-form for proper vertical alignment and collapsed behavior in narrow viewports. Use the alignment options to decide where it resides within the navbar content.

As a heads up, .navbar-form shares much of its code with .form-inline via mixin.

img4.png  Some form controls, like input groups, may require fixed widths to be show up properly within a navbar.

 

img280.png

 

13.4 Buttons

Add the .navbar-btn class to <button> elements not residing in a <form> to vertically center them in the navbar.

img281.png

img282.png

 

13.8 Text

Wrap strings of text in an element with .navbar-text, usually on a <p> tag for proper leading and color.

img283.png

 

13.6 Non-Nav Links

For folks using standard links that are not within the regular navbar navigation component, use the .navbar-link class to add the proper colors for the default and inverse navbar options.

img284.png

 

13.7 Fixed To Top

Add .navbar-fixed-top and include a .container or .container-fluid to center and pad navbar content.

img285.png

 

Body padding required

img4.png  The fixed navbar will overlay your other content, unless you add padding to the top of the <body>. Try out your own values or use our snippet below. Tip:

By default, the navbar is 50px high.

img286.png

Make sure to include this after the core Bootstrap CSS.

 

13.8 Fixed To bottom

Add .navbar-fixed-bottom and include a .container or .container-fluid to center and pad navbar content.

img287.png

 

13.9 Static Top

Create a full-width navbar that scrolls away with the page by adding .navbar- static-top and include a .container or.container-fluid to center and pad navbar content.

Unlike the .navbar-fixed-* classes, you do not need to change any padding on the body.

 

img288.png

 

13.10lnverted Navbar

Modify the look of the navbar by adding .navbar-inverse.

 

img289.png

img290.png