You need 4 pseudo elements to create this properly, because triangles are created using border
s, so they can't have a border
and different background-color
. We therefore need an inner and outer triangle for both sides. We can use both ::before
and ::after
, but since that only gives us two, we need at least two "real" elements.
Since this is a navigation panel, I used a series of li
s and placed an a
inside each one. This is a complicated setup though, so I'm going to break it down into several Fiddles showing the progression.
Edit: I've updated this so that the navigation elements are fluid, not fixed-width, per OP's comments.
First we set up the navigation boxes according to your mockup.
HTML:
<nav>
<li><a href="">Office</a></li>
<li><a href="">Office</a></li>
<li><a href="">Office Two</a></li>
<li><a href="">Short</a></li>
</nav>
CSS:
nav {
background: #1abc9c;
}
nav li {
display:inline-block;
position:relative;
margin:10px;
margin-right:0;
border: 5px solid #16a085;
padding:15px 30px;
}
nav li a {
color:white;
font-weight:bold;
display:block;
height:100%;
width:100%;
text-decoration:none;
font-size:24px;
font-family:Arial;
}

We are going to be using :before
and :after
, based on the code you provided in your question. Note, I've compressed this CSS based on rules that are shared across elements. Both inner triangles have the same color, both left arrows have the same position, etc.
CSS:
/* Arrows */
nav li:after, nav li a:after, nav li:before, nav li a:before {
left: 100%;
top: 50%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events:none; /* So that the mouse will ignore this on top of the clickable area.*/
}
nav li:before, nav li a:before {
left: -5px;
}
nav li a:before, nav li a:after {
border-left-color: #1abc9c;
border-width: 16px;
margin-top: -16px;
}
nav li:before, nav li:after {
border-left-color: #16a085;
border-width: 23px;
margin-top: -23px;
}
We've got an issue with the wrong triangles overriding others though. We can fix this with some judicial z-index
;

nav li:before {
z-index:0;
}
nav li a:before {
z-index:1;
}
nav li:after {
z-index:2;
}
nav li a:after {
z-index:3;
}
Now we have working arrows that look right, on all elements. Success! ....almost. We have the arrows appearing on all elements, and we need to hide certain arrows for the beginning and end of the navigation panel.

In this final step we want to remove the two arrows before the first header element, and the two arrows after the last child. The code is surprisingly simple with the structure we've set up so far. We need two selectors, and a display:none;
.
/* First & Last Arrow Fix */
nav li:first-child:before, nav li:first-child a:before {
display:none;
}
nav li:last-child:after, nav li:last-child a:after {
display:none;
}
And we're done!
Edit: Props to disinfo for idea of using nav
instead of header
.

Summary
As requested by OP in comments, final code is:
HTML:
<nav>
<li><a href="">Office</a></li>
<li><a href="">Office</a></li>
<li><a href="">Office Two</a></li>
<li><a href="">Short</a></li>
</nav>
CSS:
nav {
background: #1abc9c;
}
nav li {
display:inline-block;
position:relative;
margin:10px;
margin-right:0;
border: 5px solid #16a085;
padding:15px 30px;
}
nav li a {
color:white;
font-weight:bold;
display:block;
height:100%;
width:100%;
text-decoration:none;
font-size:24px;
font-family:Arial;
}
/* Arrows */
nav li:after, nav li a:after, nav li:before, nav li a:before {
left: 100%;
top: 50%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events:none; /* So that the mouse will ignore this on top of the clickable area.*/
}
nav li:before, nav li a:before {
left: -5px;
}
nav li a:before, nav li a:after {
border-left-color: #1abc9c;
border-width: 16px;
margin-top: -16px;
}
nav li:before, nav li:after {
border-left-color: #16a085;
border-width: 23px;
margin-top: -23px;
}
/* Overlapping Fix */
nav li:before {
z-index:0;
}
nav li a:before {
z-index:1;
}
nav li:after {
z-index:2;
}
nav li a:after {
z-index:3;
}
/* First & Last Arrow Fix */
nav li:first-child:before, nav li:first-child a:before {
display:none;
}
nav li:last-child:after, nav li:last-child a:after {
display:none;
}