Flip a tree structure using css - html

I'm writing a code that creates a tree structure of data. and it is as below.
ul::before {
content: '';
position: absolute;
top: 0;
left: 50%;
border-left: 2px solid #000;
width: 0;
height: 2em;
}
#theAccount {
width: 100%;
max-width: 325px;
margin: auto;
border: 1px solid #ccc;
border-radius: 5px;
margin-top: 10px;
background-color: #f4f6f9;
text-align: center;
background-color: #fff9e3;
}
ul {
position: relative;
padding: 2em 0;
white-space: nowrap;
margin: 0 auto;
text-align: center;
}
ul:after {
content: '';
display: table;
clear: both;
}
li {
display: inline-block;
vertical-align: top;
text-align: center;
list-style-type: none;
position: relative;
padding: 2em .5em 0 .5em;
}
li:before,
li:after {
content: '';
position: absolute;
top: 0;
right: 50%;
border-top: 2px solid #000;
width: 50%;
height: 2em;
}
li:after {
right: auto;
left: 50%;
border-left: 2px solid #000;
}
li:only-child:after,
li:only-child::before {
display: none;
}
li:only-child {
padding-top: 0;
}
li:first-child::before,
li:last-child::after {
border: 0 none;
}
li:last-child::before {
border-right: 2px solid #000;
border-radius: 0 5px 0 0;
}
li:first-child::after {
border-radius: 5px 0 0 0;
}
<div>
<div>
<div id="theAccount">
<h1>
Main
</h1>
</div>
<ul>
<li>
Sub1 Tyesxt </li>
<li>
Sub 2 Tyesxt
</li>
<li>
Sub3 Tyesxt
</li>
<li>
Sub4 Tyesxt
</li>
<li>
Sub5 Tyesxt
</li>
</ul>
</div>
</div>
Here the tree output that we get is top to bottom, I want to know how I can rotate it by 90 degrees. i.e. I want the tree to be from left to right like below with proper styling.
|--Sub1 Tyesxt
|--Sub2 Tyesxt
Main ------|--Sub3 Tyesxt
|--Sub4 Tyesxt
|--Sub5 Tyesxt
Please let me know how Can I get this done.
Thanks

Give a try for rotate() function.
As mdn says:
The rotate() CSS function defines a transformation that rotates an
element around a fixed point on the 2D plane, without deforming it.
Its result is a data type.
An example:
ul::before {
content: '';
position: absolute;
top: 0;
left: 50%;
border-left: 2px solid #000;
width: 0;
height: 2em;
}
#theAccount {
width: 100%;
max-width: 325px;
margin: auto;
border: 1px solid #ccc;
border-radius: 5px;
margin-top: 10px;
background-color: #f4f6f9;
text-align: center;
background-color: #fff9e3;
}
ul {
position: relative;
padding: 2em 0;
white-space: nowrap;
margin: 0 auto;
text-align: center;
}
ul:after {
content: '';
display: table;
clear: both;
}
li {
display: inline-block;
vertical-align: top;
text-align: center;
list-style-type: none;
position: relative;
padding: 2em .5em 0 .5em;
}
li:before,
li:after {
content: '';
position: absolute;
top: 0;
right: 50%;
border-top: 2px solid #000;
width: 50%;
height: 2em;
}
li:after {
right: auto;
left: 50%;
border-left: 2px solid #000;
}
li:only-child:after,
li:only-child::before {
display: none;
}
li:only-child {
padding-top: 0;
}
li:first-child::before,
li:last-child::after {
border: 0 none;
}
li:last-child::before {
border-right: 2px solid #000;
border-radius: 0 5px 0 0;
}
li:first-child::after {
border-radius: 5px 0 0 0;
}
.foo {
transform: rotate(270deg);
margin-top: 150px;
}
h1 {
transform: rotate(90deg);
}
span {
transform: rotate(90deg);
display: block;
margin: 38px 0 0 0;
}
<div>
<div class="foo">
<div id="theAccount">
<h1>
Main
</h1>
</div>
<ul>
<li>
<span>Sub1 Tyesxt</span>
</li>
<li>
<span>Sub 2 Tyesxt</span>
</li>
<li>
<span>Sub3 Tyesxt</span>
</li>
<li>
<span>Sub4 Tyesxt</span>
</li>
<li>
<span>Sub5 Tyesxt</span>
</li>
</ul>
</div>
</div>

You can also give a try with flex & grid, then border and list-style:
body > div > div {
display: grid;
grid-template-columns: repeat(2, auto);
width: max-content;
margin: auto;
align-items: center;
font-size: 18px;
}
#theAccount {
display: flex;
}
#theAccount:after {
content: "";
width: 7.5vw;/* whatever*/
border: solid 1px ;
margin: auto 0;
}
h1 {
border-radius: 0.25em;
border: solid 1px;
padding: 0.15em 0.25em;
background: ivory;
}
ul {
border-left: solid 3px;
padding: 0;
border-radius: 15px;
}
li {
list-style: "\23e4\23e4\2800";
list-style-position: inside;
padding: 0;
margin: 0.5em 0;
}
li:first-of-type {
margin-top: -0.55em;
}
li:last-of-type {
margin-bottom: -0.45em;
}
li:first-of-type,
li:last-of-type {
list-style: "\2800\23e4\2800\20 ";
list-style-position: inside;
}
<div>
<div>
<div id="theAccount">
<h1>Main</h1>
</div>
<ul>
<li>Sub1 Tyesxt </li>
<li>Sub2 Tyesxt</li>
<li>Sub3 Tyesxt</li>
<li>Sub4 Tyesxt</li>
<li>Sub5 Tyesxt</li>
</ul>
</div>
</div>

Related

CSS process flow arrows - bad formatting?

I modified 3 different peoples code to make css arrows and I think I made it more complicated than it needs to be. Any CSS expert than can help me clean this up?
I can't seem to modify padding and other attributes to get this where I want it within the divs.
css
<style>
/* These are the Stage Arrows - styles */
#testStatus {
position: relative;
width: auto;
height: 30px;
left: 10px;
}
.testStatus li {
position: relative;
text-indent: 10px;
height: 30px;
display: inline-block;
zoom: 1;
margin-left: -3px;
padding: 10px 10px 10px 10px;
color: white;
font-size: 12px;
text-align: center;
line-height: auto;
}
ul.testStatus {
list-style: none;
}
li.testStatus:first-child:after, li.testStatusGood:after, li.testStatusNoGood:after {
content: "";
position: absolute;
width: 0;
height: 0;
border-top: 15px solid transparent;
border-left: 10px solid #767676;
border-bottom: 15px solid transparent;
margin: -10px 0px 0px 10px;
z-index: 3;
}
li.testStatus:last-child:before, li.testStatusGood:before, li.testStatusNoGood:before {
content: "";
position: absolute;
width: 0;
height: 0;
left: 0;
border-top: 15px solid transparent;
border-left: 10px solid #EEEEEE;
border-bottom: 15px solid transparent;
margin: -10px 0px 0px 0px;
z-index: 2;
}
li.testStatus:first-child {
padding-left: 10px;
margin-left: 0;
background-color: #767676;
}
li.testStatus:last-child {
padding-right: 10px;
background-color: #767676;
}
li.testStatusGood {
background-color: #77a942;
}
li.testStatusGood:after {
border-left: 10px solid #77a942;
}
li.testStatusNoGood {
background-color: #c42c00;
}
li.testStatusNoGood:after {
border-left: 10px solid #c42c00;
}
/* End arrow formatting */
</style>
html
<ul>
<li>
<div id="testStatus">
<ul class="testStatus">
<li class="testStatus">Step 1</li>
<li class="testStatusGood">Step 2</li>
<li class="testStatusNoGood">Step 3</li>
<li class="testStatusNoGood">Step 4</li>
<li class="testStatus">Step 5</li>
</ul>
</div>
</li>
</ul>
My arrows display nicely but I am having difficulty adjusting the padding to 0. I've tried the #, the ul class, the il class and I am a bit baffled why I cannot remove the 10px (I believe its the padding).
There is also a faintly darker border on the left side of the triangular portion of the arrows, if you look closely, that I'd like to have match the color exactly.
Duo's code output above image, Ojer code output below image
I'm going backwards :)
Here you go:
.breadcrumbs {
border: 1px solid #cbd2d9;
border-radius: 0.3rem;
display: inline-flex;
overflow: hidden;
}
.breadcrumbs__item {
background: #fff;
color: #333;
outline: none;
padding: 0.75em 0.75em 0.75em 1.25em;
position: relative;
text-decoration: none;
transition: background 0.2s linear;
}
.breadcrumbs__item:hover:after,
.breadcrumbs__item:hover {
background: #edf1f5;
}
.breadcrumbs__item:focus:after,
.breadcrumbs__item:focus,
.breadcrumbs__item.is-active:focus {
background: #323f4a;
color: #fff;
}
.breadcrumbs__item:after,
.breadcrumbs__item:before {
background: white;
bottom: 0;
clip-path: polygon(50% 50%, -50% -50%, 0 100%);
content: "";
left: 100%;
position: absolute;
top: 0;
transition: background 0.2s linear;
width: 1em;
z-index: 1;
}
.breadcrumbs__item:before {
background: #cbd2d9;
margin-left: 1px;
}
.breadcrumbs__item:last-child {
border-right: none;
}
.breadcrumbs__item.is-active {
background: #edf1f5;
}
/* Some styles to make the page look a little nicer */
body {
color: #323f4a;
background: #f5f7fa;
display: flex;
align-items: center;
justify-content: center;
}
html, body {
height: 100%;
}
.gray{
background-color:gray;
}
.breadcrumbs__item.gray:after{
background-color:gray;
}
.red{
background-color:red;
}
.breadcrumbs__item.red:after{
background-color:red;
}
.green{
background-color:green;
}
.breadcrumbs__item.green:after{
background-color:green;
}
<li class="breadcrumbs">
Prospect
Opportunity
Accound
Sales
Support
</li>
This can work for you.
Check this Pen
HTML:
<ul class="steps">
<li class="past">
<span>
<strong>Step 1</strong>
</span><i></i>
</li>
<li class="present">
<span>
<strong>Step 2</strong>
</span><i></i>
</li>
<li class="future">
<span>
<strong>Step 3</strong>
</span><i></i>
</li>
<li class="future1">
<span>
<strong>Step 4</strong>
</span><i></i>
</li>
<li class="present1">
<span>
<strong>Step 5</strong>
</span><i></i>
</li>
</ul>
CSS:
.steps {
padding-left: 0;
list-style: none;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 12px;
line-height: 1;
margin: 30px auto;
border-radius: 3px;
}
.steps strong {
font-size: 14px;
display: block;
line-height: 2.1;
}
.steps > li {
position: relative;
display: block;
/* border: 1px solid #ddd; */
padding: 12px 50px 8px 50px;
width: 140px;
height: 40px;
}
#media (min-width: 768px) {
.steps > li {
float: left;
}
.steps .past {
color: #fff;
background: blue;
}
.steps .present {
color: #000;
background: yellow;
}
.steps .future {
color: #fff;
background: green;
}
.steps .present1 {
color: #000;
background: red;
}
.steps .future1 {
color: #fff;
background: purple;
}
.steps .present1 {
color: #fff;
}
.steps li > span:after,
.steps li > span:before {
content: "";
display: block;
width: 0px;
height: 0px;
position: absolute;
top: 0;
left: 0;
border: solid transparent;
border-left-color: #f0f0f0;
border-width: 30px;
}
.steps li > span:after {
top: -4px;
z-index: 1;
border-left-color: white;
border-width: 34px;
}
.steps li > span:before {
z-index: 2;
}
.steps li.past + li > span:before {
border-left-color: blue;
}
.steps li.present + li > span:before {
border-left-color: yellow;
}
.steps li.future + li > span:before {
border-left-color: green;
}
.steps li.future1 + li > span:before {
border-left-color: purple;
}
.steps li:first-child > span:after,
.steps li:first-child > span:before {
display: none;
}
/* Arrows at start and end */
.steps li:first-child i,
.steps li:last-child i {
display: block;
position: absolute;
top: 0;
left: 0;
border: solid transparent;
border-left-color: white;
border-width: 30px;
}
.steps li:last-child i {
left: auto;
right: -30px;
border-left-color: transparent;
border-top-color: white;
border-bottom-color: white;
}
}

css progress bar with background color and border color

I need tab control like this
can any one please help me how to do.
I am able to create tab without background color like bellow:
#crumbs {
width: 100%;
display: grid;
}
#crumbs ul {
list-style: none;
padding: 7px 5px;
margin: 0px;
}
#crumbs ul li a {
display: block;
float: left;
height: 50px;
background: #3498db;
text-align: center;
padding: 30px 40px 0 80px;
position: relative;
margin: 0 10px 0 0;
font-size: 20px;
text-decoration: none;
color: #fff;
width: 22%;
}
#crumbs ul li a:after {
content: "";
border-top: 40px solid transparent;
border-bottom: 40px solid transparent;
border-left: 40px solid #3498db;
position: absolute;
right: -40px;
top: 0;
z-index: 1;
}
#crumbs ul li a:before {
content: "";
border-top: 40px solid transparent;
border-bottom: 40px solid transparent;
border-left: 40px solid #fff;
position: absolute;
left: 0;
top: 0;
}
#crumbs ul li a.inprogress {
display: block;
float: left;
height: 50px;
background: #34db3a;
text-align: center;
padding: 30px 40px 0 80px;
position: relative;
margin: 0 10px 0 0;
font-size: 20px;
text-decoration: none;
color: #fff;
width: 22%;
}
#crumbs ul li a.inprogress:after {
content: "";
border-top: 40px solid transparent;
border-bottom: 40px solid transparent;
border-left: 40px solid #34db3a;
position: absolute;
right: -40px;
top: 0;
z-index: 1;
}
#crumbs ul li a.inprogress:before {
content: "";
border-top: 40px solid transparent;
border-bottom: 40px solid transparent;
border-left: 40px solid #fff;
position: absolute;
left: 0;
top: 0;
}
#crumbs ul li a.cpmpleted {
display: block;
float: left;
height: 50px;
background: #b334db;
text-align: center;
padding: 30px 40px 0 80px;
position: relative;
margin: 0 10px 0 0;
font-size: 20px;
text-decoration: none;
color: #fff;
width: 22%;
}
#crumbs ul li a.cpmpleted:after {
content: "";
border-top: 40px solid transparent;
border-bottom: 40px solid transparent;
border-left: 40px solid #b334db;
position: absolute;
right: -40px;
top: 0;
z-index: 1;
}
#crumbs ul li a.cpmpleted:before {
content: "";
border-top: 40px solid transparent;
border-bottom: 40px solid transparent;
border-left: 40px solid #fff;
position: absolute;
left: 0;
top: 0;
}
<div id="crumbs">
<ul>
<li>One</li>
<li>Two</li>
<li> Three </li>
</ul>
</div>
I would consider skew transformation and pseudo element like this:
ul {
list-style: none;
margin: 0;
padding: 0;
display: flex;
padding: 0 20px;
}
li {
padding: 10px 30px;
position: relative;
}
li:before {
content: "";
z-index: -1;
position: absolute;
top: 0;
bottom: 50%;
right: 0;
left: 0;
background: var(--c);
transform: skew(40deg);
}
li:after {
content: "";
z-index: -1;
position: absolute;
top: 50%;
bottom: 0;
right: 0;
left: 0;
background: var(--c);
transform: skew(-40deg);
}
li.active:before {
border: 2px solid orange;
border-bottom: none;
}
li.active:after {
border: 2px solid orange;
border-top: none;
}
<ul>
<li style="--c:red"> Step 1</li>
<li style="--c:green" class="active"> Step 2</li>
<li style="--c:blue"> Step 3</li>
</ul>

HTML/CSS - creating an "arrow" on one side of a DIV

I am transforming a div to give it a point on one end like an arrow. I've accomplished this using a second div and a CSS transform to rotate its borders 45 degrees. My issue is the background on the original div bleeds through and still forms a square. How can I solve this issue? I've created a fiddle at the below link, I would like the blue background of "Step 1" to end in the point instead of the flat edge. Thank you. Fiddle
<ul class="progress">
<li class="completed">
<span>
<span class="order">1 </span>Step 1
</span>
<div class="diagonal"></div>
</li>
<li>
<span>
<span class="order">2 </span>Step 2
</span>
<div class="diagonal"></div>
</li>
<li>
<span>
<span class="order">3 </span>Step 3
</span>
</li>
</ul>
CSS:
.progress {
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
height: 40px;
margin: 0 0 1em;
padding: 0;
}
.progress > li {
width: 100% !important;
height: 100% !important;
border-radius: 0 !important;
color: #fff !important;
list-style: none;
font-size: 16px;
z-index: 100;
background-color: #bbb;
overflow: hidden;
}
.progress > li:last-child {
border-right: 0;
}
.progress > li.completed {
background-color: #0071bc;
}
.progress > li span {
position: relative;
top: 5px;
}
.progress > li span .order {
display: inline-block;
border: 2px solid #555;
border-radius: 27px;
width: 27px;
height: 27px;
background-color: #fff;
color: #555;
margin: 0 5px 0 10px;
font-weight: bold;
text-align: center;
position: relative;
top: -1px;
line-height: 25px;
}
.diagonal {
width: 28px;
height: 28px;
position: relative;
float: right;
top: -7px;
}
.diagonal:after {
content: "";
position: absolute;
border-top: 2px solid #f5f5f5;
border-right: 2px solid #f5f5f5;
width: 38px;
height: 38px;
transform: rotate(45deg);
transform-origin: 0% 0%;
}
You can make a right arrow/triangle like that by setting a transparent top and bottom border, then give a left border of the color you want the arrow to be. Then style it so it works with your layout.
.progress {
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
height: 40px;
margin: 0 0 1em;
padding: 0;
}
.progress > li {
width: 100% !important;
height: 100% !important;
border-radius: 0 !important;
color: #fff !important;
list-style: none;
font-size: 16px;
background-color: #bbb;
position: relative;
}
.progress > li:last-child {
border-right: 0;
}
.progress > li.completed {
background-color: #0071bc;
}
.progress > li:not(.completed) {
padding-left: 20px;
}
.progress > li span {
position: relative;
top: 5px;
}
.progress > li span .order {
display: inline-block;
border: 2px solid #555;
border-radius: 27px;
width: 27px;
height: 27px;
background-color: #fff;
color: #555;
margin: 0 5px 0 10px;
font-weight: bold;
text-align: center;
position: relative;
top: -1px;
line-height: 25px;
}
.diagonal {
width: 0;
height: 0;
border-top: 20px solid transparent;
border-bottom: 20px solid transparent;
border-left: 20px solid #bbb;
top: 0; right: 0;
position: absolute;
transform: translateX(100%);
z-index: 1;
}
.completed .diagonal {
border-left-color: #0071bc;
}
<ul class="progress">
<li class="completed">
<span>
<span class="order">1 </span>Step 3
</span>
<div class="diagonal"></div>
</li>
<li>
<span>
<span class="order">2 </span>Step 2
</span>
<div class="diagonal"></div>
</li>
<li>
<span>
<span class="order">3 </span>Step 3
</span>
</li>
</ul>

Justify menu with css

Im working on menu, which is text justified. To make this working, I add an new line. the problem is that it should be zero pixels. However, it's breaking layout
JS fiddle to see it in work
https://jsfiddle.net/z1qsL739/1/
<div class="registration-menu">
<ul class="reg-menu-list">
<li class="active">some </li>
<li>some</li>
<div class="justify-fix"></div>
</ul>
</div>
Css
.registration-menu{
background: white;
border-top: 4px solid green;
border-bottom: 4px solid green;
}
.reg-menu-list{
list-style: none;
display: inline-block;
text-align: justify;
width: 100%;
line-height: 0em;
color: green;
font-size: 0px;
margin: 0;
padding: 0;
.justify-fix{
width: 100%;
line-height: 0em;
height: 0;
display: inline-block;
content: ' ';
}
li{
display: inline-block;
line-height: 1em;
font-size: 18px;
&.active{
background: #fde8be;
border-top: 4px solid #ffb642;
border-bottom: 4px solid #ffb642;
margin: -4px 0 -4px 0;
}
a{
padding: 10px;
display: inline-block;
}
&:hover{
#include transition(all .4s ease);
background: #fde8be;
}
}
}
Try by adding the following rules, height: 46px; to the .registration-menu and padding: 4px 0; to the .reg-menu-list
.registration-menu {
background: white none repeat scroll 0 0;
border-bottom: 4px solid green;
border-top: 4px solid green;
height: 46px;
}
.reg-menu-list {
color: green;
display: inline-block;
font-size: 0;
line-height: 0;
list-style: outside none none;
padding: 4px 0;
text-align: justify;
width: 100%;
}
A div is not allowed inside a list as a direct child. A modern and straightforward way to go is using flexbox positioning, e.g.
ul {
list-style: none;
margin: 0;
padding: 0;
display: flex;
flex-direction: row;
justify-content: space-around;
}
Example: http://codepen.io/anon/pen/dpbWJk?editors=0100
You don't need the div at all, use a pseudo-element
.registration-menu {
background: white;
border-top: 4px solid green;
border-bottom: 4px solid green;
}
.reg-menu-list {
list-style: none;
text-align: justify;
width: 100%;
line-height: 0em;
color: green;
font-size: 0px;
margin: 0;
padding: 0;
}
.reg-menu-list::after {
width: 100%;
line-height: 0em;
height: 0;
display: inline-block;
content: ' ';
}
li {
display: inline-block;
line-height: 1em;
font-size: 18px;
background: pink;
}
li.active {
background: #fde8be;
border-top: 4px solid #ffb642;
border-bottom: 4px solid #ffb642;
margin: -4px 0 -4px 0;
}
a {
padding: 10px;
display: inline-block;
}
a:hover {
#include transition(all .4s ease);
background: #fde8be;
}
<div class="registration-menu">
<ul class="reg-menu-list">
<li class="active">some
</li>
<li>some
</li>
<li>some
</li>
<li>some
</li>
<li>some
</li>
<li>some
</li>
</ul>
</div>
remove display: inline-block from .reg-menu-list

Create the triangles in css

How this one can achieved in CSS. I googled out but i didn't find any solution.
Try this:
HTML
<nav class="nav">
<ul>
<li>1. Account Info</li>
<li>2. Verification</li>
<li>3. Enjoy</li>
</ul>
</nav>
StyleSheet
.nav ul {
margin: 0;
padding: 0;
list-style: none;
overflow: hidden;
width: 100%;
}
.nav ul li {
float: left;
margin: 0 .2em 0 1em;
}
.nav ul a {
background: red;
padding: .3em 1em;
float: left;
text-decoration: none;
color: #fff;
position: relative;
}
.nav ul li:first-child a:before {
content: normal;
}
.nav ul li:last-child a:after {
content: normal;
}
.nav ul a:before {
content: "";
position: absolute;
top: 50%;
margin-top: -1.5em;
border-width: 1.5em 0 1.5em 1em;
border-style: solid;
border-color: red rgba(0, 0, 0, 0);
left: -1em;
margin-left: 1px;
}
.nav ul a:after {
content: "";
position: absolute;
top: 50%;
margin-top: -1.5em;
border-top: 1.5em solid rgba(0, 0, 0, 0);
border-bottom: 1.5em solid rgba(0, 0, 0, 0);
border-left: 1em solid red;
right: -1em;
margin-right: 1px;
}
Here is the Demo
Try:
HTML:
<div class="arrow">
<p>1. Acount Info</p>
</div>
<div class="arrow2">
<p>2. Verification</p>
</div>
<div class="arrow3">
<p>3. Enjoy</p>
</div>
CSS:
.arrow {
width: 200px;
height: 33px;
background-color: red;
border: 1px solid red;
position: relative;
display:inline-block;
}
.arrow:after {
content:'';
position: absolute;
top: 0px;
left: 201px;
width: 0;
height: 0;
border: 17px solid transparent;
border-left: 12px solid red;
}
.arrow2 {
width: 200px;
height: 33px;
background-color: red;
border: 1px solid red;
position: relative;
display: inline-block;
margin-left: 8px;
}
.arrow2:after {
content:'';
position: absolute;
top: 0px;
left: 201px;
width: 0;
height: 0;
border: 17px solid transparent;
border-left: 12px solid red;
}
.arrow2:before {
content:'';
position: absolute;
top: 0px;
left: -1px;
width: 0;
height: 0;
border: 17px solid transparent;
border-left: 12px solid white;
}
.arrow3 {
width: 200px;
height: 33px;
background-color: red;
border: 1px solid red;
position: relative;
display: inline-block;
margin-left: 8px;
}
.arrow3:before {
content:'';
position: absolute;
top: 0px;
left: -1px;
width: 0;
height: 0;
border: 17px solid transparent;
border-left: 12px solid white;
}
p {
color:white;
text-align: center;
margin-top: 6px;
}
And the DEMO
Here's my attempt: http://codepen.io/anon/pen/xDeCd/
This example works well even if the user changes his font-size or triggers a page zoom. List-items should not break in several lines if the browser is resized.
Screenshot
Markup
<ol>
<li>1. Account info</li>
<li>2. Verification</li>
<li>3. Enjoy</li>
</ol>
(add links if/where necessary, I've just supposed they are not links but simply information labels about the required steps during a process).
Relevant CSS
ol {
white-space: nowrap;
}
li:after, li:before {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
position: absolute;
top: 0;
width: 1em;
height: 100%;
}
li {
display: inline-block;
position: relative;
height: 3em;
padding: 0 1em;
margin-right: 3em;
background: #d12420;
color: #f0f0f0;
font: 1em/3em Arial;
}
li + li { margin-left: -1.8em; }
li:not(:last-child):after {
left: 100%;
content: "";
border-left: 1em solid #d12420;
border-top: 1.5em solid transparent;
border-bottom: 1.5em solid transparent;
}
li + li:before {
content: "";
right: 100%;
border-left: 1em solid #transparent;
border-top: 1.5em solid #d12420;
border-bottom: 1.5em solid #d12420;
}
li:nth-child(1) { z-index: 3; }
li:nth-child(2) { z-index: 2; }
li:nth-child(3) { z-index: 1; }
Here is some code, it may be useful for youDEMO
<div class="breadcrumb flat">
<a class="active" href="#">1.Account Verification</a>
2.Verification
3.Enjoy
</div>