CSS: Create a breadcrumb

rosiequ

Ruxin Qu

Posted on August 15, 2022

CSS: Create a breadcrumb

Breadcrumb example 1

Breadcrumb example 1

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
ul.breadcrumb{
    list-style: none;
    padding: 15px;
    background-color: lightgray;

}

ul.breadcrumb li{
    display: inline-block;
    font-size: 20px;
    font-family: sans-serif;
}

ul.breadcrumb a{
    text-decoration: none;
}

ul.breadcrumb li+li::before{
    content: '/\00a0';
    padding: 8px;
}

ul.breadcrumb a:hover{
    text-decoration: underline;
    cursor: pointer;
}
</style>
</head>
<body>

<h2>Breadcrumb Pagination</h2>
<ul class="breadcrumb">
  <li><a href="#">Home</a></li>
  <li><a href="#">Pictures</a></li>
  <li><a href="#">Dahuang</a></li>
  <li>Beach</li>
</ul>

</body>
</html>
Enter fullscreen mode Exit fullscreen mode

Breadcrumb example 2

Image description

.breadcrumb {
    text-align: left;

  }
  .breadcrumb li{
    list-style: none;
    float: left;
  }
  .breadcrumb a {
    display: block;
    text-align: center;
    color: #fff;
    background-color: darkcyan;
    text-decoration: none;
    position: relative;
    height: 30px;
    line-height: 30px;
    margin-right: 15px;
    padding: 0 5px;
  }

  .breadcrumb  a::before,
  .breadcrumb  a::after {
    content: "";
    position: absolute;
    border-color: darkcyan;
    border-style: solid;
    border-width: 15px 5px;
  }

  .breadcrumb  a::after {
    left: 100%;
    border-color: transparent;
    border-left-color: darkcyan;
  }
  .breadcrumb  a::before {
    left: -10px;
    border-left-color: transparent;
  }

  .breadcrumb  a:hover {
    background-color: blue;
  }
  .breadcrumb  a:hover::before {
    border-color: blue;
    border-left-color: transparent;
  }
  .breadcrumb  a:hover::after {
    border-left-color: blue;
  }
Enter fullscreen mode Exit fullscreen mode
💖 💪 🙅 🚩
rosiequ
Ruxin Qu

Posted on August 15, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

10 Tricks for HTML Semantic Tags
html 10 Tricks for HTML Semantic Tags

November 29, 2024

PAIN:The other story of css
webdev PAIN:The other story of css

November 21, 2024

Add Flip Card in your Project
webdev Add Flip Card in your Project

November 20, 2024

Add Flip Card in your Project
webdev Add Flip Card in your Project

November 20, 2024

10 essential CSS resources
css 10 essential CSS resources

November 13, 2024