Liste der Anhänge anzeigen (Anzahl: 2)
[3.1.x] Simples CSS3 Dropdown Menü
CSS für ein Dropdown Menü, funktioniert nur im Header mit HTML 5 Templates, muss also ggf. angepasst werden.
LESS (Da ich nicht benötigte Variablen entfernt habe, sieht die Namensgebung u.U. etwas komisch aus ;))
Code:
@navBorderRadius: 5px;
.navBorderRadius (@navBorderRadius: 5px) {
border-radius: @navBorderRadius;
-webkit-border-radius: @navBorderRadius;
-moz-border-radius: @navBorderRadius;
}
@navBackground: steelblue;
@navBackgroundHover: darken(steelblue, 10%);
@navColor: #222;
@navLinkColor: white;
@navLinkColorHover: white;
@navFont: "Trebuchet MS", Arial, sans-serif;
.navBoxShadow (@navBoxShadow: 0 0 3px 0 rgba(0,0,0,0.4)) {
box-shadow: @navBoxShadow;
-webkit-box-shadow: @navBoxShadow;
-moz-box-shadow: @navBoxShadow;
}
.navTransition (@navTransition: all .2s ease-in-out) {
transition: @navTransition;
-webkit-transition: @navTransition;
-moz-transition: @navTransition;
}
/* ==========================================================================
Module: Navigation
========================================================================== */
nav ul {
padding: 0;
margin: 0;
list-style-type: none;
font-family: @navFont;
color: @navColor;
}
nav ul li a,
nav ul li a:hover {
text-decoration: none;
white-space: nowrap;
}
nav ul li span {
cursor: default;
white-space: nowrap;
}
/* Module: Header Navigation
========================================================================== */
header nav > ul {
background: @navBackground;
.navBorderRadius;
.navBoxShadow;
}
header nav > ul > li {
display: inline-block;
text-align: center;
margin-right: 1px;
.navBorderRadius;
}
header nav ul li span,
header nav ul li a {
color: @navLinkColor;
display: block;
padding: 0.625em 0.9375em;
}
header nav ul li a:hover {
color: @navLinkColorHover;
}
header nav > ul > li:hover,
header nav > ul > li.active,
header nav > ul > li.trail {
background: @navBackgroundHover;
color: @navLinkColorHover;
}
header nav ul ul {
position: absolute;
opacity: 0;
visibility: hidden;
z-index: 1;
padding: 8px 0 0 0;
.navTransition;
}
header nav ul li:hover > ul {
opacity: 1;
visibility: visible;
}
header nav ul ul li{
position: relative;
background: @navBackgroundHover;
}
header nav ul ul li.first {
.navBorderRadius(@navBorderRadius @navBorderRadius 0 0);
}
header nav ul ul li.last {
.navBorderRadius(0 0 @navBorderRadius @navBorderRadius);
}
header nav ul ul li.first.last {
.navBorderRadius;
}
header nav ul ul li:hover,
header nav ul ul li.active,
header nav ul ul li.trail {
background: lighten(@navBackgroundHover, 10%);
}
header nav ul ul li.first:after {
content: '';
position: absolute;
left: 25%;
top: -6px;
margin-left: -5px;
border-style: solid;
border-width: 0 5px 6px 5px;
border-color: transparent transparent @navBackgroundHover transparent;
}
header nav ul ul li.first:hover:after,
header nav ul ul li.first.active:after,
header nav ul ul li.first.trail:after {
border-color: transparent transparent lighten(@navBackgroundHover, 10%) transparent;
}
header nav ul ul ul {
padding: 0 0 0 8px;
left: 100%;
top: 0;
}
header nav ul ul ul li.first:after {
left: 0;
top: 50%;
margin-left: -6px;
margin-top: -5px;
border-width: 5px 6px 5px 0;
border-color: transparent @navBackgroundHover transparent transparent;
}
header nav ul ul ul li.first:hover:after,
header nav ul ul ul li.first.active:after,
header nav ul ul ul li.first.trail:after {
border-color: transparent lighten(@navBackgroundHover, 10%) transparent transparent;
}
CSS
Code:
/* ==========================================================================
Module: Navigation
========================================================================== */
nav ul {
padding: 0;
margin: 0;
list-style-type: none;
font-family: "Trebuchet MS", Arial, sans-serif;
color: #222222;
}
nav ul li a,
nav ul li a:hover {
text-decoration: none;
white-space: nowrap;
}
nav ul li span {
cursor: default;
white-space: nowrap;
}
/* Module: Header Navigation
========================================================================== */
header nav > ul {
background: #4682b4;
border-radius: 5px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
box-shadow: 0 0 3px 0 rgba(0, 0, 0, 0.4);
-webkit-box-shadow: 0 0 3px 0 rgba(0, 0, 0, 0.4);
-moz-box-shadow: 0 0 3px 0 rgba(0, 0, 0, 0.4);
}
header nav > ul > li {
display: inline-block;
text-align: center;
margin-right: 1px;
border-radius: 5px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
}
header nav ul li span,
header nav ul li a {
color: #ffffff;
display: block;
padding: 0.625em 0.9375em;
}
header nav ul li a:hover {
color: #ffffff;
}
header nav > ul > li:hover,
header nav > ul > li.active,
header nav > ul > li.trail {
background: #38678f;
color: #ffffff;
}
header nav ul ul {
position: absolute;
opacity: 0;
visibility: hidden;
z-index: 1;
padding: 8px 0 0 0;
transition: all 0.2s ease-in-out;
-webkit-transition: all 0.2s ease-in-out;
-moz-transition: all 0.2s ease-in-out;
}
header nav ul li:hover > ul {
opacity: 1;
visibility: visible;
}
header nav ul ul li {
position: relative;
background: #38678f;
}
header nav ul ul li.first {
border-radius: 5px 5px 0 0;
-webkit-border-radius: 5px 5px 0 0;
-moz-border-radius: 5px 5px 0 0;
}
header nav ul ul li.last {
border-radius: 0 0 5px 5px;
-webkit-border-radius: 0 0 5px 5px;
-moz-border-radius: 0 0 5px 5px;
}
header nav ul ul li.first.last {
border-radius: 5px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
}
header nav ul ul li:hover,
header nav ul ul li.active,
header nav ul ul li.trail {
background: #4682b4;
}
header nav ul ul li.first:after {
content: '';
position: absolute;
left: 25%;
top: -6px;
margin-left: -5px;
border-style: solid;
border-width: 0 5px 6px 5px;
border-color: transparent transparent #38678f transparent;
}
header nav ul ul li.first:hover:after,
header nav ul ul li.first.active:after,
header nav ul ul li.first.trail:after {
border-color: transparent transparent #4682b4 transparent;
}
header nav ul ul ul {
padding: 0 0 0 8px;
left: 100%;
top: 0;
}
header nav ul ul ul li.first:after {
left: 0;
top: 50%;
margin-left: -6px;
margin-top: -5px;
border-width: 5px 6px 5px 0;
border-color: transparent #38678f transparent transparent;
}
header nav ul ul ul li.first:hover:after,
header nav ul ul ul li.first.active:after,
header nav ul ul ul li.first.trail:after {
border-color: transparent #4682b4 transparent transparent;
}