How to create a breadcrumb navigation with CSS?

CSSWeb DevelopmentFront End Technology

Following is the code to create breadcrumb navigation using CSS −

Example

 Live Demo

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<style>
body {
   margin: 0px;
   margin-top: 10px;
   padding: 0px;
}
.breadcrumb {
   background-color: rgb(39, 39, 39);
   overflow: auto;
   height: auto;
}
li {
   display: inline-block;
   text-align: center;
   padding: 10px;
   font-size: 17px;
}
.links {
   text-decoration: none;
   color: rgb(178, 137, 253);
}
.links:hover {
   text-decoration: underline;
}
.breadcrumb ul li:before {
   padding: 8px;
   color: white;
   content: "/\00a0";
   text-decoration: none;
}
ul:last-child {
   color: white;
   font-weight: bolder;
   font-family: monospace;
}
</style>
</head>
<body>
<h1>Breadcrumb Navigation Example</h1>
<div class="breadcrumb">
<ul>
<li><a class="links" href="#">Root</a></li>
<li><a class="links" href="#">Home</a></li>
<li><a class="links" href="#">User</a></li>
<li><a class="links" href="#">Desktop</a></li>
<li>Games</li>
</ul>
</div>
<h2>Hover over the links to see effect</h2>
</body>
</html>

Output

The above code will produce the following output −

raja
Published on 06-Apr-2020 15:03:15
Advertisements