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

http://getbootstrap.com/

  • Click on “Download Bootstrap” button
  • Unzip file

Note the three folders:

  1. css
  2. img
  3. 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:

  1. 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">
  2. 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">
  3. 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]-->
  4. 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>

Leave a Reply

Your email address will not be published. Required fields are marked *