Skip to main content

Breadcrumbs & Multi-Step Indicator for Web Designer


Breadcrumbs & Multi-Step Indicator for Web Designer




Breadcrumbs & Multi-Step Indicator




A handy snippet to create responsive CSS breadcrumbs or multi-step indicators with ease.







Breadcrumbs and multi-step indicators share a similar structure (a simple list of items), we created a handy snippet to create and customize them with a preset of time-saving classes








Creating the structure



The HTML structure is very basic: an ordered list of items, wrapped into a <nav>element.



<nav>
<ol class="cd-breadcrumb">
<li><a href="#0">Home</a></li>
<li><a href="#0">Gallery</a></li>
<li><a href="#0">Web</a></li>
<li class="current"><em>Project</em></li>
</ol>
</nav>




Adding style & Guidelines




We created 2 main classes for the

    element: .cd-breadcrumb and .cd-multi-steps. Although they share a similar style, we wanted to differentiate the two web components since they serve a different purpose. For the basic version, we used the ::after pseudo-element of the list items to create the separator element:


.cd-breadcrumb li::after, .cd-multi-steps li::after {
display: inline-block;
content: '\00bb';
margin: 0 .6em;
color: #959fa5;
}




We created a preset of CSS classes – to be added to the

    element, that modify the style of the web component. For example: if you want to use a custom icon as a separator between items (example number 2), just use the .custom-separator class.


<nav>
<ol class="cd-breadcrumb custom-separator">
<li><a href="#0">Home</a></li>
<li><a href="#0">Gallery</a></li>
<li><a href="#0">Web</a></li>
<li class="current"><em>Project</em></li>
</ol>
</nav>



Then remember to update the background image of ::after pseudo-element of the list item:



.cd-breadcrumb.custom-separator li::after, 
.cd-multi-steps.custom-separator li::after {
/* replace the default separator with a custom icon */
content: '';
height: 16px;
width: 16px;
background: url(../img/cd-custom-separator.svg) no-repeat center center;
vertical-align: middle;
}




The .custom-icons class is for adding custom icons before each list item. Once again you need to update the CSS according to the images you want to use. In our demo we used a .svg file as image sprites:




.cd-breadcrumb.custom-icons li > *::before, 
.cd-multi-steps.custom-icons li > *::before {
/* add a custom icon before each item */
content: '';
display: inline-block;
height: 20px;
width: 20px;
margin-right: .4em;
margin-top: -2px;
background: url(../img/cd-custom-icons-01.svg) no-repeat 0 0;
vertical-align: middle;
}
.cd-breadcrumb.custom-icons li:not(.current):nth-of-type(2) > *::before,
.cd-multi-steps.custom-icons li:not(.current):nth-of-type(2) > *::before {
/* change custom icon using image sprites */
background-position: -20px 0;
}
.cd-breadcrumb.custom-icons li:not(.current):nth-of-type(3) > *::before,
.cd-multi-steps.custom-icons li:not(.current):nth-of-type(3) > *::before {
background-position: -40px 0;
}
.cd-breadcrumb.custom-icons li:not(.current):nth-of-type(4) > *::before,
.cd-multi-steps.custom-icons li:not(.current):nth-of-type(4) > *::before {
background-position: -60px 0;
}
.cd-breadcrumb.custom-icons li.current:first-of-type > *::before,
.cd-multi-steps.custom-icons li.current:first-of-type > *::before {
/* change custom icon for the current item */
background-position: 0 -20px;
}
.cd-breadcrumb.custom-icons li.current:nth-of-type(2) > *::before,
.cd-multi-steps.custom-icons li.current:nth-of-type(2) > *::before {
background-position: -20px -20px;
}
.cd-breadcrumb.custom-icons li.current:nth-of-type(3) > *::before,
.cd-multi-steps.custom-icons li.current:nth-of-type(3) > *::before {
background-position: -40px -20px;
}
.cd-breadcrumb.custom-icons li.current:nth-of-type(4) > *::before,
.cd-multi-steps.custom-icons li.current:nth-of-type(4) > *::before {
background-position: -60px -20px;
}





The .triangle class generates CSS triangles after each list item. To create the separation between items we used a trick we found on CSS-Tricks.




.cd-breadcrumb.triangle li::after,

  .cd-breadcrumb.triangle li > *::after {

    /*

    li > *::after is the colored triangle after each item

    li::after is the white separator between two items

    */

    content: '';

    position: absolute;

    top: 0;

    left: 100%;

    content: '';

    height: 0;

    width: 0;

    /* 48px is the height of the <a> element */

    border: 24px solid transparent;

    border-right-width: 0;

    border-left-width: 20px;

  }

  .cd-breadcrumb.triangle li::after {

    /* this is the white separator between two items */

    z-index: 1;

    -webkit-transform: translateX(4px);

    -moz-transform: translateX(4px);

    -ms-transform: translateX(4px);

    -o-transform: translateX(4px);

    transform: translateX(4px);

    border-left-color: #ffffff;

    /* reset style */

    margin: 0;

  }

  .cd-breadcrumb.triangle li > *::after {

    /* this is the colored triangle after each element */

    z-index: 2;

    border-left-color: inherit;

  }

  .cd-breadcrumb.triangle li:last-of-type::after,

  .cd-breadcrumb.triangle li:last-of-type > *::after {

    /* hide the triangle after the last step */

    display: none;

  }



Other classes to keep in mind are: .text-center.text-top and .text-bottom to be used with the .cd-multi-steps class to set the position of the labels, and .count if you want to add a counter to the multi-steps indicator.





<nav>
<ol class="cd-multi-steps text-bottom count">
<li class="visited"><a href="#0">Cart</a></li>
<li class="visited" ><a href="#0">Billing</a></li>
<li class="current"><em>Delivery</em></li>
<li><em>Review</em></li>
</ol>
</nav>





The easiest way to understand how this resource works is by checking the source files: most classes can be combined, and we covered all possible combinations in the 9 examples of the demo.



Enjoy!


















Comments

Popular posts from this blog

Windows 7 Home Premium 32 Bit free download Direct Link

People often ask us which version of Windows they should purchase for their new PC build. Generally speaking Windows 7 Home Premium Edition has everything that most end users would need for normal day-to-day usage of their PC. There is no use in paying extra for Windows 7 Professional Edition if the added features will be of no benefit to you. Here is a list of the major differences between Windows 7 Home Premium and Windows 7 Professional. Memory support Home Premium:  16GB of physical memory supported Recent tests of a mid range Windows 7 based PC with configurations of 4GB, 8GB and 16GB of system memory have shown only a marginal overall performance benefit between 8GB and 4GB. No performance improvement was evident when moving from 8GB to 16GB, therefore I do not see the 16GB physical memory limitation of Home Edition to be an issue when choosing an operating system. Backup and restore Home Premium:  Limited to local HDD or DVD The Backup and Restore centre was first int...

Making a Really Cool jQuery Image Gallery

jQuery Image Gallery In this tutorial we will create a beautiful jQuery Image Gallery for website using jQuery Lightbox plugin.You can use this gallery in your website or you can show images.One of the main benefits of using a popular java script library, such as jQuery, is the incredible number of available plug-ins that will kick-start any development project. There is no need to Download the plug-in – I’ve included it in the demo files, so grab them and get on reading. The XHTML We start off with our XHTML front-end. demo.php <div id="container"> <div id="heading"> <!-- the heading --> <h1>A cool jQuery gallery</h1> </div> <div id="gallery"> <!-- this is the containing div for the images --> <?php //our php code goes here ?> <div class="clear"></div> <!-- using clearfix --> </div> <div id="footer"> <!-- some tutorial info --> </div...

How to Build a Professional Website /Learn how to build website

Build a professional website ,and earn money using your website .Learn all these all lessons step by step.Y ou will learn how to structure a web page using HTML , style a web page using CSS , and how to do all of this quickly using Bootstrap . Build the Airbnb home page and learn the fundamentals of web developmen t in the process.You will learn how to structure a web page using HTML , style a web page using CSS , and how to do all of this quickly using Bootstrap. What you will learn You will learn how to structure a web page using HTML, style a web page using CSS, and how to do all of this quickly using Bootstrap. We had done worked hard on this topic  please give us  like  &  Share  Credit..                 If you want to save your work then follow these instructions:- 1.Select 1st lesson if you are beginner 2.SignIn option is given on the header of these lessons.Click SignIn 3.SignIn using Facebook Acco...