Inserting a crisp white divider between items in breadcrumb navigation in the form of arrowheads

I have designed a unique custom breadcrumb with an arrow shape :

    <ol class="breadcrumb-arrow">
        <li class="active"><a href="#">1. Foo<span class="arrow"></span></a>                 </li>
        <li ><a href="#">2. Blah<span class="arrow"></span></a></li>
    </ol>

CSS:

.breadcrumb-arrow {
  padding: 0;
  margin: 0;
  height: 30px;
  line-height: 30px;
  list-style-type: none;
}
.breadcrumb-arrow li {
  float: left;
  background-color: black;
}
.breadcrumb-arrow li.active {
  background-color: pink;
}
.breadcrumb-arrow li.active a span {
  border-left-color: pink;
  border-top-color: grey;
  border-bottom-color: grey;
}
.breadcrumb-arrow li.active ~ li {
  background-color: grey;
}
.breadcrumb-arrow li.active ~ li a {
  color: black;
}
.breadcrumb-arrow li.active ~ li a span {
  border-left-color: grey;
  border-top-color: grey;
  border-bottom-color: grey;
}
.breadcrumb-arrow li a {
  color: white;
  float: left;
  position: relative;
  padding: 0 20px 0 10px;
  text-decoration: none;
}
.breadcrumb-arrow li a span {
  position: absolute;
  display: block;
  height: 0;
  width: 0;
  line-height: 0px;
  right: 0px;
  top: 0px;
  border-left: 10px solid black;
  border-right: none;
  border-top: 15px solid pink;
  border-bottom: 15px solid pink;
}

The active element will be in pink, the ones already done will be in black, and the ones to be done will be in grey. I referenced this tutorial for the design inspiration : It's functional but I want to add 2px of white (arrow shaped) spacing between each breadcrumb element. I believe I need to use the :after selector.

Despite trying, I couldn't achieve it. Does anyone have any ideas?

Maybe something like this :

.breadcrumb-arrow li a span:after { 
    content: " "; 
    display: block; 
    width: 0; 
    height: 0;
    border-top: 50px solid transparent;
    border-bottom: 50px solid transparent;
    border-left: 30px solid white;
    position: absolute;
    top: 50%;
    margin-top: -50px; 
    left: 100%;
}

I struggled to make it work as intended. Here is a plunker showcasing the issue : http://plnkr.co/edit/Hp9sBSpyiFvTLbw2lCg3?p=preview

Answer №1

In my approach, I implemented a unique z-index workaround by adjusting the left-padding on the "a" tags and making specific changes to the first-child element.

.breadcrumb-arrow li a span:after { 
    content: " ";
    display: block;
    border-top: 15px solid transparent;
    border-bottom: 15px solid transparent;
    border-left: 10px solid white;
    position: absolute;
    top: -15px;
    left: 0;
    z-index: 1;
}

.breadcrumb-arrow li:first-child a {
    padding-left:10px;
}

For a modified version of this technique, you can check out the updated code: http://plnkr.co/edit/8fhG4sL23DkWQIj9Pmr5?p=preview

Feel free to explore this solution, which also involves adjusting the border-color properties for the "li active" span to match the desired outcome.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Creating a custom navigation bar that elegantly fades away with a smooth animation as you scroll down the page is a must-have

How can I create a navigation bar that disappears when scrolling, with a smooth animation? This is the progress I have made so far. HTML: <!DOCTYPE html> <html> <head> <link rel="stylesheet" href="css/style.css" type="tex ...

Creating a default menu within a specific route in Ember.js is a crucial step in

I have created a JSBin code for my Ember.js application which can be found here: When I click on Item A, I want the ABCD menu on the left to remain visible and not disappear. Thank you. ...

Using RadStyleSheetManager for Optimizing CSS Caching

After implementing the RadStyleSheetManager in my master pages using the given code snippet, I noticed a significant improvement in the performance of my web application. In Internet Explorer 8, the number of dynamically generated WebResource.axd files had ...

Retrieve JSON data within a service and provide it to a component

I am currently facing an issue with loading data from a JSON file into my component using a service. The data is successfully loaded in the service, as confirmed by the console log; however, when trying to access the data in the component, it does not disp ...

Are checkboxes embedded within labels?

There are two common ways that people code checkboxes on the web, and I'm wondering which one is considered correct. <input id="a" type="checkbox"/><label for="a">checkbox</label> <label for="b"><input id="b" type="checkbo ...

Issues detected between Angular and Express rendering operations

Having an issue with my angular code. It runs perfectly on its own, but when I try to access it on localhost with express, it only displays the HTML file. Here's my server code: var express = require('express'), app = express(); app ...

SQL Delete rows from Table

I am dealing with an issue where a table displaying notices has a clear option next to each row, but when the clear button is clicked nothing happens. The setup involves a button that triggers a clear function. What could be causing this problem? <bu ...

Setting the default <a-sky> in Aframe: A step-by-step guide

There was a fascinating projection I witnessed where two images were displayed in the sky. [https://codepen.io/captDaylight/full/PNaVmR/][code] Upon opening it, you are greeted with two spheres and a default white background. As you move your cursor over ...

When I adjust the size of my browser, the elements on my HTML page shift around

I'm facing an issue where all my elements move when I resize my browser, and I cannot figure out why. How can I ensure that they stay in their respective positions even when the browser is resized? Is there a CSS solution for this? Thank you! body ...

Can a screenshot of a YouTube video be printed exactly as it appears on a website?

Is there a way to print a page with an embedded YouTube video without it showing up as a blank area? I want the printed version to display the same still shot that appears on the web. If this isn't possible, I will use a noprint stylesheet. Here is ho ...

Bootstrap: Retrieve an image from a modal

I am working on a modal that contains a variety of selectable images. When an image is clicked, I want to change the text of the button in the modal to display the name of the selected image. Additionally, I would like to grab the selected image and displa ...

The Yeoman/Grunt-usemin is failing to update the index.html file even after adding new JavaScript code

As I work on developing a web app using Yeoman and the Angular generator on Windows 7, I go through the process of running 'yo angular' followed by 'grunt' to build the app for deployment. The index.html file in the dist folder gets upd ...

`The font appears extremely thin when viewed on Safari and iOS devices.`

I'm struggling to resolve the issue with super-thin fonts on Safari/iOS despite trying all recommended solutions. Here is the comparison: https://i.stack.imgur.com/5DVHz.png The _document.js file: import Document, { Html, Head, Main, NextScript } fr ...

Navigating AJAX Pages - Maximize the Potential of #home and Other Sections

I am working on creating AJAX pages using a tutorial I found on Tutorialzine. The script I am using loads pages using AJAX but it requires specifying the page number in the URL like http://example.com/#page1 or http://example.com/#page2. Is there a way t ...

Implementing dynamic content loading using CSS and jQuery upon link/button activation

I'm facing an issue where I am attempting to align content to the left side of my screen to display a feed while also ensuring that the pushed content is responsive. Unfortunately, the feed is not visible and the content remains unresponsive. Is ther ...

Making sure all items in the top row of Flexbox columns have the same height

Within my flex wrapper, I have multiple column components with various flex items inside. Each column displays content adjacent to each other. The challenge is to ensure that the top item in each column has an equal height, creating a row-like effect. I&a ...

Achieve a responsive layout by dynamically sizing child div elements to fill their parent container using percentage-based margins and

I'm having trouble getting the child divs to stretch to the parent, and I'm not sure if I need to specify a % width on #fullpage-content even though #middle is set to 76%. I seem to have forgotten... Would you like to check out this link where c ...

Having trouble with JSON/jQuery syntax?

I am attempting to populate a set of DIVs with image backgrounds by reading images from a specific folder. The jQuery code I have written is shown below: $.getJSON('../functions.php', function(images) { images.each( function() { $('#m ...

Error code 102 appeared, stating: "The server has declined the connection attempt"

Recently, I successfully developed a Facebook application that mirrors the registration and sign-in features of my website. Users have the option to register or log in to my site through their Facebook accounts. To achieve this, I created a basic HTML page ...

hide content on both desktop and mobile devices

I can't seem to figure out what's wrong here and my mind is blank. I have 2 tables - one for desktop users and one for mobile users. I attempted to hide one using the display none property in my code. .mobile{display: none;} This CSS was mean ...