← Back to Bootstrap Course | Chapter 1: Getting Started | Lesson 6 of 7

First Bootstrap page

A first page combines the HTML5 skeleton, the CDN links, a container and a few components.

In this page:

  1. First Bootstrap page
Syntax
markup
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
  <title>Title</title>
</head>
<body>
  <!-- content -->
</body>
</html>

First Bootstrap page

Start from the standard HTML5 template with the viewport meta tag, add the Bootstrap CSS link, then build content with a container, a navbar, a jumbotron-style section and buttons. Save it as an .html file and open it in the browser.

Note: Bootstrap's own starter template is the best skeleton to copy.

Example: First Bootstrap page

markup
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body class="p-3">
<nav class="navbar navbar-dark bg-dark">
  <div class="container"><a class="navbar-brand" href="#">My First Page</a></div>
</nav>
<div class="container py-5">
  <div class="p-5 mb-4 bg-body-tertiary rounded-3">
    <h1 class="display-5 fw-bold">Welcome</h1>
    <p class="fs-5">This page uses a navbar, a container, utilities and a button.</p>
    <a class="btn btn-primary btn-lg" href="#">Get started</a>
  </div>
</div>
</body>
</html>
Live Example
Related Topics
Common Mistakes
  1. Missing the doctype
  2. Forgetting the container
  3. Loading the CSS after your own CSS
Chapter Summary
  • Use the HTML5 skeleton
  • Add viewport and CSS link
  • Build inside a container
  • Add JS bundle for interactive parts
🔒

Chapter Quiz — Complete all 7 topics to unlock

0/7 topics done

Complete these topics first:

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.