triangle with border by rotating a box

by danield770

HTML

<div class="page" id="one">page one</div>
<div class="page" id="two">page two</div>
<div class="page" id="three">page three</div>

<div class="top">
    <div class="arrow"></div>
    <ul>
        <li><a href="#one">One</a></li>
        <li><a href="#two">Two</a></li>
        <li><a href="#three">Three</a></li>
    </ul>
</div>

CSS

*
{
    margin:0;padding:0;
}
.top
{
    background: #eee;   
    position:relative;
    overflow: hidden;  
}
.arrow
{
    border-bottom: 1px solid #c2c2c2;
    height: 50px;
    
}
.arrow:before
{
    content: '';
    display: block;
    width: 14px;
    height: 14px;
    border: 1px solid #c2c2c2;
    border-radius: 3px;
    position:absolute;
    bottom:-9px;
    left: 30px;
    background: #fff;
    -webkit-transform: rotate(45deg);
    -moz-transform: rotate(45deg);
    -ms-transform: rotate(45deg);
    -o-transform: rotate(45deg); 
    transform: rotate(45deg);
    
    -webkit-transition: left, 0.5s;
    -moz-transition: left, 0.5s;
    -o-transition: left, 0.5s;
    transition: left, 0.5s;
}
ul
{
    position: absolute;
    top: 0;
    list-style: none;
    padding-left: 20px;
    margin-top: 15px;
}
li
{
    display: inline-block;
    text-decoration: none;
    font-size: 18px;
    color: #676767;
    margin-right: 40px;
}
.page
{
    width: 100%;
    height: 200px;
    position: absolute;
    top: 80px;
    opacity: 0;
    background: yellow;
    -webkit-transition: opacity, 0.5s;
    -moz-transition: opacity, 0.5s;
    -o-transition: opacity, 0.5s;
    transition: opacity, 0.5s;
}
.page:target
{
    opacity: 1;
}

#two
{
    background: pink;
}
#three
{
    background: brown;
}
#one:target ~ .top .arrow:before
{
    left: 30px;
}
#two:target ~ .top .arrow:before
{
    left: 105px;
}
#three:target ~ .top .arrow:before
{
    left: 189px;
}