Create Your First Page
Now that you know how to add Bootstrap, let us build a real page. We will use the standard starter template that almost every Bootstrap project begins with.
Step 1: Create the File
- Create a new folder named
bootstrap-course. - Open it in VS Code.
- Create a new file called
index.html.
Step 2: Paste the Starter Template
Step 3: Understand Each Part
| Line | Purpose |
|---|---|
<!DOCTYPE html> | Tells the browser this is a modern HTML5 page. Bootstrap needs it to work correctly |
<html lang="en"> | Sets the language, which helps search engines and screen readers |
<meta charset="UTF-8"> | Allows all characters, including symbols and other languages |
<meta name="viewport" ...> | Makes the page responsive on mobile phones |
<link ... bootstrap.min.css> | Loads Bootstrap's styles |
<script ... bootstrap.bundle.min.js> | Loads Bootstrap's interactive features |
Step 4: Add Some Content
Replace the <h1> line with this code to see more of Bootstrap in action:
What Did We Use?
containercenters the content and gives it side spacemt-5adds a margin on the top (space above)text-primarymakes the text blueleadmakes the paragraph slightly largerbtn btn-successcreates a green button
A page with a big blue heading, a larger paragraph and a green Get Started button, all centered neatly.
Step 5: See It Responsive
Open index.html in your browser. Drag the edge of the window to make it narrower, or press F12 and click the phone icon. Notice that the container adapts to the screen width.
Common Mistakes
- Forgetting
rel="stylesheet"in the link tag - Saving the file as
index.html.txt - Missing the closing
</div>tag - Opening the wrong file in the browser
btn-success to btn-danger, btn-warning and btn-dark. Refresh and see the color change each time.
Conclusion
You now have a working Bootstrap page, and this template will be the base for almost every lesson. Keep the file; you will reuse it often.

