I am not sure if this is even remotely possible, or if i possibly have to rewrite a lot of my code, but anyway; here goes:
If you take a look at the below picture, what i want to achieve is the middle button (green one) in the navigation bar to drop shadows on the 2 other menu buttons, giving the menu a 3D'ish look.
However, first of all i can't get the box shadow to fall properly, as i'm working with a trapezoid and not a box. Also i don't believe i have the skillset to work with SVGs yet.
The second problem is that the green button has a lower z-index compared to the other 2 buttons, since that is how i achieve its actual shape.
My code is posted below the picture.
HTML (the rest of the HTML is dynamically generated by WP, and site is not online yet.
<div class="row" id="navbar"> <!-- Navigation row -->
<div class="col-md-12">
<?php wp_nav_menu( array( 'theme_location' => 'hovedmenu' ) ); ?>
</div>
</div>
CSS:
#navbar{
z-index: 3;
position:relative;
box-shadow: 3px 3px 5px #000;
}
#navbar li{
display:inline-block;
height:100px;
line-height:100px;
width:33.333333333333333%;
color:black;
text-align:center;
font-size:22px;
font-weight:bold;
background-color:white;
padding:0;
}
#navbar li a{
color:black;
}
body.page-id-10 #navbar li:nth-child(1) > a, body.page-id-12 #navbar li:nth-child(2) > a, body.page-id-14 #navbar li:nth-child(3) > a{
color:white;
}
#navbar li:hover{
color:white;
}
#navbar li:nth-child(1), #navbar li:nth-child(2), #navbar li:nth-child(3){
float:left;
position:relative;
cursor:pointer;
text-align: center;
}
#navbar li:nth-child(1):hover, body.home li:nth-child(1), body.home li:nth-child(1):after, body.page-id-10 #navbar li:nth-child(1):after,body.page-id-10 .page-item-10, #navbar li:nth-child(1):hover:after, body.page-id-10 #sidebar, body.home #sidebar{
color: white;
background-color: #234e7b;
background-image: -webkit-linear-gradient(top, #234e7b, #0d2951);
background-image: -moz-linear-gradient(top, #234e7b, #0d2951);
background-image: -ms-linear-gradient(top, #234e7b, #0d2951);
background-image: -o-linear-gradient(top, #234e7b, #0d2951);
background-image: linear-gradient(top, #234e7b, #0d2951);
}
#navbar li:nth-child(1):after{
content: "";
position: absolute;
background: none repeat scroll 0% 0% #00F;
top: 0px;
right: -51px;
bottom: 0px;
width: 100px;
transform: skew(-40deg);
z-index: 1;
background-color: #FFF;
}
#navbar li:nth-child(2){
}
#navbar li:nth-child(2):hover, body.page-id-12 .page-item-12, #navbar li:nth-child(2):hover:after, #navbar li:nth-child(2):hover:before, body.page-id-12 #sidebar{
color:white;
background-color: #12910f;
background-image: -webkit-linear-gradient(top, #12910f, #0b4b0e);
background-image: -moz-linear-gradient(top, #12910f, #0b4b0e);
background-image: -ms-linear-gradient(top, #12910f, #0b4b0e);
background-image: -o-linear-gradient(top, #12910f, #0b4b0e);
background-image: linear-gradient(top, #12910f, #0b4b0e);
}
#navbar li:nth-child(2):before{
content: "";
position: absolute;
background: none repeat scroll 0% 0% #F00;
top: 0px;
left: 0px;
bottom: 0px;
width: 50px;
transform: skew(-40deg);
background-color: #FFF;
}
#navbar li:nth-child(2):after{
content: "";
position: absolute;
background: none repeat scroll 0% 0% #F00;
top: 0px;
right: 0px;
bottom: 0px;
width: 50px;
transform: skew(40deg);
z-index: 10;
background-color: #FFF;
}
#navbar li:nth-child(3):before{
content: "";
position: absolute;
background: none repeat scroll 0% 0% #F00;
top: 0px;
left: -51px;
bottom: 0px;
width: 100px;
transform: skew(40deg);
z-index:100;
background-color: #FFF;
}
body.page-id-14 #navbar .page-item-14, body.page-id-14 #navbar li:nth-child(3):before, #navbar li:nth-child(3):hover, #navbar li:nth-child(3):hover:before{
background-image: -webkit-linear-gradient(top, #f83838, #c00000);
background-image: -moz-linear-gradient(top, #f83838, #c00000);
background-image: -ms-linear-gradient(top, #f83838, #c00000);
background-image: -o-linear-gradient(top, #f83838, #c00000);
background-image: linear-gradient(top, #f83838, #c00000);
}
#navbar li:hover > a{
color:white;
text-decoration: none;
}