Creating the Sticky Footer with Fixed Navbar example using Bootstrap 3 and Emmet
Outdated: This post is preserved for reference and may no longer reflect current tools or services.
This post describes how to use Emmet shortcuts to quickly create Bootstrap’s Sticky Footer with Fixed Navbar example using Bootstrap 3.
Step 1: Set up the HTML, body content, and JavaScript
Emmet code
html:5>(div.navbar.navbar-default.navbar-fixed-top>div.container>div.navbar-header>btn:r.navbar-toggle>span.sr-only{Toggle navigation}+span.icon-bar+span.icon+span.icon^a.navbar-brand{Welcome!}^div.collapse.navbar-collapse>ul.nav.navbar-nav>li*3>a^li.dropdown>a.dropdown-toggle{Dropdown }>b.caret^ul.dropdown-menu>li*3>a^li.divider+li.dropdown-header{Nav Header}+li*3>a^^^^^^^div.container>div.page-header>h1{Page Header Heer}^p.lead>lorem^^div#footer>div.container>p.text-muted{Copy Right Info}^^script:src{js/jquery-1.11.0.min.js}+script:src{js/bootstrap.min.js})
There are a few limitations with Emmet, such as not being able to define the JavaScript source location directly, so we will need to make some manual tweaks.
Tweaking the output
For this specific code, we will need to:
- Add
role="navigation"tonavbar.navbar-default.navbar-fixed-top - Add
data-toggle="collapse" data-target=".navbar-collapse"to the toggle navigation<button> - Add your link under
navbar-brand - Update the links, text, and active item in
nav.navbar-nav - In the dropdown toggle, add
data-toggle="dropdown" - Edit the
h1tag inside thepage-headerdiv - Update the copyright information
- Move the JavaScript path between the
<script>tags intosrc=""
Step 2: Insert the rest of the header information
Emmet code
Next, use an edit point to fill in the header tags. Please note that you will need to place your cursor under the <title> tag.
meta:vp+link:favicon+meta:compat+link:css{css/bootstrap.min.css}+link:css
Tweaking the output
Now we will need to make a few more changes.
- Add
favicon.icoif needed - Change
ie=7toie=edgein the meta tag - In the
style.cssfile where Bootstrap is nested, cut and paste the Bootstrap stylesheet in place ofstyles.css - Between the updated Bootstrap CSS and
styles.css, paste your conditional comments
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
In styles.css, paste the Bootstrap example styles from the Bootstrap example CSS file.