Simple Bootstrap Page

Posted onby admin

In previous bootstrap chapters, we learned what is bootstrap? and how to setup bootstrap environment. Now, we will learn how to create a simple bootstrap hello world application by using bootstrap components with example.

To create a bootstrap web page template, first we need to include HTML5 doctype at the beginning of the page, along with lang and viewport meta tags for proper responsive behavior as shown below.

<!DOCTYPE html>
<html>
<head>
<!-- Required meta tags -->
<meta charset='utf-8'>
<meta name='viewport'>
</head>
<body>
………
</body>
</html>

If you observe the above HTML code, we added lang and chartset attributes to specify the language and chart encoding for the HTML document. We included HTML5 doctype at the beginning of the page because Bootstrap requires HTML5 doctype to render HTML elements and CSS properties without any styling problems.

In this video, I'm going to show you how to create a simple web page using Bootstrap 5, but at first, we will go through what's new in the Bootstrap 5 Alpha. Find the Bootstrap login that best fits your project. The best free login snippets available. Design elements using Bootstrap, javascript, css, and html. Start Bootstrap creates free, open source, MIT license, Bootstrap themes, templates, and code snippets for you to use on any project, guides to help you learn more about designing and developing with the Bootstrap framework, and premium Bootstrap UI products.

As discussed, the Bootstrap framework is built with a mobile-first strategy to ensure that the design is responsive for mobile devices. So, to ensure proper rendering and touch zooming for all devices we included viewport meta tag in <head> element.

Simple Bootstrap Login Page

Here, the width=device-width part is useful to adjust the page width based on the screen width of the device and initial-scale=1 part is useful to set the initial zooming level whenever the page is first loaded by the browser.

Along with the above meta tags, we need to include the required Bootstrap CSS and JS files to convert the above HTML template to a bootstrap template like as shown below.

Bootstrap Simple Login Page

Live Preview<!DOCTYPE html>
<html>
<head>
<title>Bootstrap Example</title>
<meta charset='utf-8'>
<meta name='viewport'>
<!-- Bootstrap CSS -->
<link href='https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css'>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src='https://code.jquery.com/jquery-3.4.1.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js'></script>
<script src='https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js'></script>
</head>
<body>
<h1>Hello World</h1>
</body>
</html>

Simple Bootstrap Page With Header And Footer

This is the basic template format that we need to create to use a bootstrap framework in our application. Here, the JS files (jquery.js, popper.js, bootstrap.js) are optional, and those are required to add only when you try to use bootstrap JS components such as alerts, modals, buttons for toggling, carousel for sliding, tooltips, etc.

While adding JS files (jquery.js, popper.js, bootstrap.js), you need to make sure that the jQuery comes first, second Popper.js, and last bootstrap.js file like as we mentioned in the above code.

Bootstrap simple login page

Simple Bootstrap Page

To improve the performance of your web pages, include your JavaScript files at the bottom of the page, right before the closing </body> tag, instead of adding it in <head> tag.

Simple Bootstrap Template

The above example will return the result as shown below.