8 Practical Bootstrap Projects by Maria Antonietta Perna
Author:Maria Antonietta Perna [Various]
Language: eng
Format: epub
Publisher: SitePoint
Published: 2017-08-08T23:00:00+00:00
Let’s Begin Building Our Responsive Bootstrap Website
I’ve divided the above responsive web page into different categories, and we’ll see how to build each one of them in detail:
the responsive navigation
the marketing area
the contents section
the right sidebar
the footer
The Responsive Navigation
Let’s build the navigation bar of the website. It will contain the website’s title and some right-aligned menu link items. This is going to be fixed to the top of the website, as you’ve seen in the demo page. So here’s the markup for this:
<nav class="navbar fixed-top navbar-expand-md navbar-light bg-light">
The navbar class is for showing the navigation section. An additional fixed-top class makes it stick to the top of the page. The navbar-light and bg-light classes control the text color and background color of the navigation bar respectively. Pretty clear!
Let’s move ahead and insert some more code into it:
<nav class="navbar fixed-top navbar-expand-md navbar-light bg-light"> <div class="container"> <!-- more navigation code here --> </div> </nav>
The container is used to contain everything inside the navigation bar as a wrapper.
Till now, whatever we’ve added is just the basic structure of our navigation bar. Let’s see the real magical stuff that makes the navigation responsive.
<nav class="navbar fixed-top navbar-expand-md navbar-light bg-light"> <div class="container"> <a class="navbar-brand" href="#">Responsive Website</a> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button> <div class="collapse navbar-collapse" id="navbarCollapse"> <!-- left navigation links --> <ul class="navbar-nav mr-auto"> <!-- active navigation link --> <li class="nav-item active"> <a class="nav-link" href="#">Home <span class="sr-only">(current)</span> </a> </li> <!-- regular navigation link --> <li class="nav-item"> <a class="nav-link" href="#">About</a> </li> <!-- more navigation links --> </ul> <!-- right navigation link --> <ul class="nav navbar-nav ml-auto"> <li class="nav-item"> <a class="nav-link" href="#">Login</a> </li> </ul> </div> </div> </nav>
The branding and menu items are self-explanatory. It should be clear that adding the class navbar-brand gives the title a clean look and is used for the website’s name. The nav items are wrapped inside an additional div with the classes collapse navbar-collapse, which are used to make the menu appear like a stack when viewing in smaller browsers.
Just below the branding, you might be seeing an additional link with the navbar-toggler class that wraps a span navbar-toggler-icon. This link is visible only on the smaller screens with a list icon. Also see we’ve used data-toggle=collapse that Bootstrap uses to hide/show the menu items in smaller windows. data-target is used to identify which menus to hide/show.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Deep Learning with Python by François Chollet(12580)
Hello! Python by Anthony Briggs(9918)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9797)
The Mikado Method by Ola Ellnestam Daniel Brolund(9780)
Dependency Injection in .NET by Mark Seemann(9342)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8304)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7765)
Grails in Action by Glen Smith Peter Ledbrook(7699)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7560)
Becoming a Dynamics 365 Finance and Supply Chain Solution Architect by Brent Dawson(7105)
Microservices with Go by Alexander Shuiskov(6873)
Practical Design Patterns for Java Developers by Miroslav Wengner(6785)
Test Automation Engineering Handbook by Manikandan Sambamurthy(6732)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6420)
Angular Projects - Third Edition by Aristeidis Bampakos(6143)
The Art of Crafting User Stories by The Art of Crafting User Stories(5667)
NetSuite for Consultants - Second Edition by Peter Ries(5599)
Demystifying Cryptography with OpenSSL 3.0 by Alexei Khlebnikov(5409)
Kotlin in Action by Dmitry Jemerov(5068)
