Bootstrap CSS Quick Start with Example Codes
There is 2 different way for integrating Bootstrap CSS. One them is using CDN & Other one is download locally and then integrate.
Personally I always prefer to Download Bootstrap then integrate locally. It has lots of reasons, but I am not going to discuss those I will show 2 ways. You can choose which you prefer.
Download Bootstrap & Integrate Locally
Actually I am following the below directory structures for my project, if you want then can choose it, otherwise you can create by your own.
- project
-- index.html
-- pages (dir)
--- other-pages.html
-- assets (dir)
--- css
--- js
--- fonts
Follow the Integration process
-
Click to download
-
Find Compiled CSS and JS then click Download, Wait until the download complete
-
Extract the bootstrap-x.x.x-dist.zip archive
-
Then open bootstrap-x.x.x-dist >> css, find the file called bootstrap.min.css
-
Copy bootstrap.min.css and paste to project >> assets >> css
-
Then open bootstrap-x.x.x-dist >> js, find the file called bootstrap.bundle.min.js
-
Copy bootstrap.bundle.min.js and paste to project >> assets >> js
-
Create a file called index.html and add the below codes. You may follow our HTML Tutorial for more understanding
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="assets/css/bootstrap.min.css" rel="stylesheet">
<title>Bootstrap Tutorial</title>
</head>
<body>
<h1>Bootstrap Bismillah Template</h1>
<script src="assets/js/bootstrap.bundle.min.js"></script>
</body>
</html>
Bootstrap Integration Using CDN CSS & JS
-
Create an index-cdn.html file with the below codes.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap Tutorial</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
</head>
<body>
<h1>Bootstrap Bismillah Template</h1>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
</body>
</html>