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

Codecanyon-King MEDIA v1.9.7 | Nulled Script | free download

King Media v1.9.7 Preview   Screenshots Download About King Media KingMedia is a content sharing script suitable for different posts formats: image upload image share from different hosts video posts with automated thumbnails creation Technical Info Created Updated High Resolution Compatible Browsers Files Software Version 5 June 14 27 May 15 Yes IE11, Firefox, Safari, Opera, Chrome JavaScript JS, JavaScript JSON, HTML, CSS, PHP PHP 4.x, PHP 5.x, PHP 5.0 - 5.2, PHP 5.3, PHP 5.4 Features Image Upload & Share From Url , Youtube, Facebook, Vimeo, VK, Vine, Instagram, Metacafe, DailyMotion Videos and Soundcloud Comments for Media Facebook Comments Responsive Layout User Profile & Points Tags or Category System Super Easy Installation Full Admin Panel Moderate Guest Submissions Social Share Buttons Search for Media Seo Url Much More… Gold Media Reviews Download Now! Requirements PHP 4.3 or later, PHP 5.4.x for all functionality. MySQL 4.1 or ...

Opera Browser Offline Installer Latest Version Free Download(Win+Mac+Linux+Android)

Opera Browser About Opera Browser Download Opera Browser Offline Installer Latest Version.Opera is also available in both offline and live installer.Opera products enable more than 350 million internet consumers to discover and connect with the content and services that matter most to them, no matter what device, network or location. In turn, we help advertisers reach the audiences that build value for their businesses. Opera also delivers products and services to more than 120 operators around the world, enabling them to provide a faster, more economical and better network experience to their subscribers. From family photos and funny videos to business ideas that change the world economy, the internet has always been about discovery. Whether you are a consumer getting online for the first time, or a multinational corporation trying to reach the right audience, Opera can help you discover more online. Opera for Windows Opera browser – Do more on the web Opera Features Stay in sync Eas...

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...