How to create a responsive website with Bootstrap 4?

BootstrapWeb DevelopmentFront End Technology

To create a responsive website with Bootstrap 4, the code is as follows −

Example

 Live Demo

<!DOCTYPE html>
<html>
<head>
<title>Bootstrap 4 Website Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
<style>
   body{
      height: 100vh;
   }
</style>
</head>
<body>
<div class="jumbotron text-center bg-dark" style="margin-bottom:0">
<h1 class="text-light">Website ⇅</h1>
</div>
<nav class="font-weight-bold navbar navbar-dark bg-primary navbar-expand-sm">
<a class="navbar-brand" href="#">Logo</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" datatarget="#collapsibleNavbar">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="collapsibleNavbar">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
</ul>
</div>
</nav>
<div class="container" style="margin-top:30px">
<div class="col-sm-8">
<h2>Headline 1</h2>
<h5>Published in January</h5>
<p class="text-justify">Lorem ipsum dolor sit amet consectetur adipisicing elit. Alias perferendis hic quas praesentium quod totam atque dignissimos nobis numquam consequuntur?</p>
<br>
<h2>Headline 2</h2>
<h5>Published in march</h5>
<p class="text-justify">Lorem ipsum dolor sit amet consectetur adipisicing elit. Aliquam doloribus incidunt voluptatum labore dolorem voluptate iure dicta, dolorum quis maiores.</p>
</div>
</div>
</div>
<footer class=" w-100 py-4 bg-dark text-white-50 position-fixed" style="bottom: 0;">
<div class="container text-center">
<small>Copyright © Website</small>
</div>
</footer>
</body>
</html>

Output

The above code will produce the following output −

On resizing the screen −

raja
Published on 12-May-2020 16:02:23
Advertisements