Fortissimo
02-05-2014, 03:53 AM
1) Script Title: CSS3 animated vertical slanted menu
2) Script URL (on DD): http://www.dynamicdrive.com/style/csslibrary/item/css3_animated_vertical_slanted_menu/
3) Describe problem:
I think the programmers have done a wonderful job with the CSS3 animated vertical slanted menu (http://www.dynamicdrive.com/style/csslibrary/item/css3_animated_vertical_slanted_menu/). For the design of my site, I need to try to flip this menu horizontally so that the menu items are left-aligned instead of right-aligned, they slide to the right instead of sliding to the left, etc. I spent some time tweaking the original code (also changed color scheme to work with my new site... and changed a few of the code comments appropriately while I was at it), and I got everything to work EXCEPT the slant! Since the original slant is created with top and right values (see 2nd-to-last code line that has a comment in it in the <style> section - the 1st and 4th parameters correspond to top and right), I thought it would only be logical to create the opposite slant using corresponding bottom and left values (2nd and 3rd values), but my efforts were to no avail. :~( Any ideas?
Here is the style code, and below that will be the HTML code:
<style>
ul.svertical-l {
width: 300px; /* width of menu */
overflow: auto; /* background of menu would go here, something like "background: black;" */
margin: 0; padding: 0;
padding-top: 7px; /* top padding */
list-style-type: none; }
ul.svertical-l li {
text-align: left; /* right align menu links */ }
ul.svertical-l li a {
position: relative;
display: inline-block;
text-indent: 5px;
overflow: hidden;
background: rgb(180, 40, 30); /* initial background color of links */
font: bold 16px Germand;
text-decoration: none;
padding: 5px; margin-bottom: 7px; /* spacing between links */
color: black;
-moz-box-shadow: inset 7px 0 5px rgba(60,30,30, 0.8); /* inner right shadow added to each link */
-webkit-box-shadow: inset 7px 0 5px rgba(60,30,30, 0.8);
box-shadow: inset 7px 0 5px rgba(60,30,30, 0.8);
-moz-transition: all 0.2s ease-in-out; /* CSS3 transition of hover properties */
-webkit-transition: all 0.2s ease-in-out;
-o-transition: all 0.2s ease-in-out;
-ms-transition: all 0.2s ease-in-out;
transition: all 0.2s ease-in-out; }
ul.svertical-l li a:hover {
padding-left: 30px; /* add left padding to expand link horizontally to the right */
color: black;
background: rgb(240, 20, 5);
-moz-box-shadow: inset 3px 0 2px rgba(60,30,30, 0.8); /* contract inner right shadow */
-webkit-box-shadow: inset 3px 0 5px rgba(60,30,30, 0.8);
box-shadow: inset 3px 0 5px rgba(60,30,30, 0.8); }
ul.svertical-l li a:before { /* CSS generated content: slanted left edge */
content: "";
position: absolute; left: 0; top: 0;
border-style: solid; border-width: 0 70px 20px 0; /* Play around with 1st and 4th value to change slant degree */
border-color: transparent transparent transparent black; /* change black to match the background color of the menu UL */ }
</style>
HTML code:
<ul class="svertical-l">
<li><a href="#">Link</a></li>
<li><a href="#">Pretty link</a></li>
<li><a href="#">Even prettier link</a></li>
<li><a href="#">Prettiest link</a></li>
<li><a href="#">Butt ugly link</a></li>
<li><a href="#">Just a link</a></li>
</ul>
2) Script URL (on DD): http://www.dynamicdrive.com/style/csslibrary/item/css3_animated_vertical_slanted_menu/
3) Describe problem:
I think the programmers have done a wonderful job with the CSS3 animated vertical slanted menu (http://www.dynamicdrive.com/style/csslibrary/item/css3_animated_vertical_slanted_menu/). For the design of my site, I need to try to flip this menu horizontally so that the menu items are left-aligned instead of right-aligned, they slide to the right instead of sliding to the left, etc. I spent some time tweaking the original code (also changed color scheme to work with my new site... and changed a few of the code comments appropriately while I was at it), and I got everything to work EXCEPT the slant! Since the original slant is created with top and right values (see 2nd-to-last code line that has a comment in it in the <style> section - the 1st and 4th parameters correspond to top and right), I thought it would only be logical to create the opposite slant using corresponding bottom and left values (2nd and 3rd values), but my efforts were to no avail. :~( Any ideas?
Here is the style code, and below that will be the HTML code:
<style>
ul.svertical-l {
width: 300px; /* width of menu */
overflow: auto; /* background of menu would go here, something like "background: black;" */
margin: 0; padding: 0;
padding-top: 7px; /* top padding */
list-style-type: none; }
ul.svertical-l li {
text-align: left; /* right align menu links */ }
ul.svertical-l li a {
position: relative;
display: inline-block;
text-indent: 5px;
overflow: hidden;
background: rgb(180, 40, 30); /* initial background color of links */
font: bold 16px Germand;
text-decoration: none;
padding: 5px; margin-bottom: 7px; /* spacing between links */
color: black;
-moz-box-shadow: inset 7px 0 5px rgba(60,30,30, 0.8); /* inner right shadow added to each link */
-webkit-box-shadow: inset 7px 0 5px rgba(60,30,30, 0.8);
box-shadow: inset 7px 0 5px rgba(60,30,30, 0.8);
-moz-transition: all 0.2s ease-in-out; /* CSS3 transition of hover properties */
-webkit-transition: all 0.2s ease-in-out;
-o-transition: all 0.2s ease-in-out;
-ms-transition: all 0.2s ease-in-out;
transition: all 0.2s ease-in-out; }
ul.svertical-l li a:hover {
padding-left: 30px; /* add left padding to expand link horizontally to the right */
color: black;
background: rgb(240, 20, 5);
-moz-box-shadow: inset 3px 0 2px rgba(60,30,30, 0.8); /* contract inner right shadow */
-webkit-box-shadow: inset 3px 0 5px rgba(60,30,30, 0.8);
box-shadow: inset 3px 0 5px rgba(60,30,30, 0.8); }
ul.svertical-l li a:before { /* CSS generated content: slanted left edge */
content: "";
position: absolute; left: 0; top: 0;
border-style: solid; border-width: 0 70px 20px 0; /* Play around with 1st and 4th value to change slant degree */
border-color: transparent transparent transparent black; /* change black to match the background color of the menu UL */ }
</style>
HTML code:
<ul class="svertical-l">
<li><a href="#">Link</a></li>
<li><a href="#">Pretty link</a></li>
<li><a href="#">Even prettier link</a></li>
<li><a href="#">Prettiest link</a></li>
<li><a href="#">Butt ugly link</a></li>
<li><a href="#">Just a link</a></li>
</ul>