Bootstrap 3 Tutorial (Part 1)
Make a Responsive Website
Quick & easy.
Note: the following instructions are for Bootstrap Version 3.1.1.
1. Download Bootstrap
- Click on “Download Bootstrap” button
- Unzip file
Note the three folders:
- css
- img
- js
2. Start with the Basic HTML template
http://getbootstrap.com/getting-started/#download
Save this code as “index.html” and save to your folder with the css, img, and js folders.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Bootstrap 101 Template</title> <!-- Bootstrap --> <link href="css/bootstrap.css" rel="stylesheet"> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[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]--> </head> <body> <h1>Hello, world!</h1> <!-- jQuery (necessary for Bootstrap's JavaScript plugins) --> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <!-- Include all compiled plugins (below), or include individual files as needed --> <script src="js/bootstrap.min.js"></script> </body> </html>
Note this code includes the following:
- Link to CSS file. I like to change the CSS file link to the full version of the CSS (instead of the minimized version) in case I want to read the CSS file.
<link href="css/bootstrap.css" rel="stylesheet">
- Viewport meta tag necessary for viewing site on mobile devices. This tells the browser to set the viewport to the width of the device with an initial scale of 1.
<meta name="viewport" content="width=device-width, initial-scale=1">
- HTML shim for IE – Enables styling of HTML5 elements in versions of Internet Explorer prior to version 9
<!--[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]-->
- Link to jQuery library. Link to bootstrap js.
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) --> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <!-- Include all compiled plugins (below), or include individual files as needed --> <script src="js/bootstrap.min.js"></script>