4-Bootstrap and jQuery
Key Objectives
Set up Bootstrap & jQuery as npm packages.
Set up proper links in head.
Set up script tags.
Understand the rule of 12s in Bootstrap.
Video
Overview
In this module, we set up Bootstrap to allow our application to be responsive, meaning that it will appear nice on a number of different device sizes (as big as iMac and as small as iPhone 5). Bootstrap is an indispensable tool for modern web developers, and this section covers just the tip of the iceberg.
Notes/Tips
The Bootstrap docs are phenomenal. Go take a look here. At this point, you don't have to understand jQuery, you just have to know that Bootstrap uses it. We'll talk about jQuery more later. Although the newest version (4.0) of Bootstrap was recently released, we are still using 3.3.7. It's perfectly safe, but be aware that version 4.0 is out there. You might run into projects that use it.
Steps
Please start by taking a look at this instructional video.
Jump onto the
module-3-bootstrap-and-jquerybranch and runnpm install.Then, run
gulp serve.Play around with the Bootstrap columns in our app and get a feel for the rule of 12s as discussed in the video. When you are done, run
git reset --hardso that you can switch branches later. This will get rid of the changes that you just did.In your own project, here are some things you'll want to do to get Bootstrap working:
Run
npm install jquery bootstrap font-awesome --savePut the proper link tag for Bootstrap.css in the head of your
index.htmlfile.Put the proper script tags for jQuery and Bootstrap at the bottom of the body.
Bootstrap needs jQuery. jQuery needs to be listed first because it needs to load first.
Add a Bootstrap navbar of your own choosing. It does not have to be the one that you end up using, just a navbar to get working. You will customize it later. The docs have excellent navbars. There's also bootsnipp.com.
If you get a customized navbar, you might have extra CSS to add. Add any extra CSS to your
main.cssfile.Commit your code and push it to your GitHub repository when finished.
After you have Bootstrap working, go to the next module.
Last updated