codice:
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>CSS drop-down menu</title>
<style type="text/css">
div.menu-bar {
position: relative;
left: 0;
top: 0;
/* menu header width and height */
height: 30px;
width: 90%;
margin: 0;
padding: 0;
background-color: #fffabf;
}
/* horizontal menu */
div.menu-bar ul {
position: absolute;
margin: 0;
padding: 0;
left: 0;
top: 0;
height: 100%;
width: 100%;
list-style-type: none;
overflow: visible;
}
div.menu-bar ul li {
display: block;
float: left;
background-color: #5d5636;
height: 100%;
/* menu header's items width */
width: 120px;
}
div.menu-bar ul li span, div.menu-bar ul li a {
display: block;
height: 100%;
width: 89%;
line-height: 30px;
padding: 0 0 0 10%;
cursor: pointer;
}
div.menu-bar ul li span, div.menu-bar ul li a, div.menu-bar ul li a:link,
div.menu-bar ul li a:visited, div.menu-bar ul li a:active {
font-family: Times New Roman;
font-size: 17px;
font-style: italic;
text-decoration: none;
background-color: #fffabf;
color: #5d5636;
}
/* vertical sub-menus */
div.menu-bar ul li ul {
float: none;
position: static;
height: auto;
/* vertical-menus width */
width: 160px;
}
div.menu-bar ul li ul li {
display: block;
height: 28px;
width: 100%;
background-color: transparent;
float: none;
}
div.menu-bar ul li:hover ul li span, div.menu-bar ul li:hover ul li a,
div.menu-bar ul li ul li a:link, div.menu-bar ul li ul li a:visited,
div.menu-bar ul li ul li a:active {
display: block;
/* menu-bar items width and horizontal-padding (total must be 160px in this example - see above) */
width: 152px;
padding: 0 0 0 8px;
height: 27px;
float: left;
line-height: 27px;
margin-top: 1px;
background-color: #dddddd;
color: #000000;
font-family: georgia, serif;
font-size: 11px;
font-style: normal;
font-weight: normal;
border-radius: 10px;
}
/* vertical sub-sub-menus */
div.menu-bar ul li:hover ul li ul {
float: right;
padding-top: 2px;
}
/* mouse-over effects: up to 6 sub-levels (you can add more sub-levels, if you want) */
div.menu-bar ul li:hover ul li:hover {
width: 201%;
}
div.menu-bar ul li:hover span, div.menu-bar ul li:hover a {
color: #220000;
background-color: #eeeabe;
}
div.menu-bar ul li:hover ul li:hover span,
div.menu-bar ul li:hover ul li:hover a,
div.menu-bar ul li:hover ul li:hover ul li:hover span,
div.menu-bar ul li:hover ul li:hover ul li:hover a,
div.menu-bar ul li:hover ul li:hover ul li:hover ul li:hover span,
div.menu-bar ul li:hover ul li:hover ul li:hover ul li:hover a,
div.menu-bar ul li:hover ul li:hover ul li:hover ul li:hover ul li:hover span,
div.menu-bar ul li:hover ul li:hover ul li:hover ul li:hover ul li:hover a,
div.menu-bar ul li:hover ul li:hover ul li:hover ul li:hover ul li:hover ul li:hover span,
div.menu-bar ul li:hover ul li:hover ul li:hover ul li:hover ul li:hover ul li:hover a,
div.menu-bar ul li:hover ul li:hover ul li:hover ul li:hover ul li:hover ul li:hover ul li:hover span,
div.menu-bar ul li:hover ul li:hover ul li:hover ul li:hover ul li:hover ul li:hover ul li:hover a {
background-color: #cccccc;
color: #000000;
}
div.menu-bar ul li:hover ul li:hover ul li span,
div.menu-bar ul li:hover ul li:hover ul li a,
div.menu-bar ul li:hover ul li:hover ul li:hover ul li span,
div.menu-bar ul li:hover ul li:hover ul li:hover ul li a,
div.menu-bar ul li:hover ul li:hover ul li:hover ul li:hover ul li span,
div.menu-bar ul li:hover ul li:hover ul li:hover ul li:hover ul li a,
div.menu-bar ul li:hover ul li:hover ul li:hover ul li:hover ul li:hover ul li span,
div.menu-bar ul li:hover ul li:hover ul li:hover ul li:hover ul li:hover ul li a,
div.menu-bar ul li:hover ul li:hover ul li:hover ul li:hover ul li:hover ul li:hover ul li span,
div.menu-bar ul li:hover ul li:hover ul li:hover ul li:hover ul li:hover ul li:hover ul li a {
background-color: #dddddd;
color: #222222;
}
div.menu-bar ul li ul, div.menu-bar ul li:hover ul li ul, div.menu-bar ul li:hover ul li:hover ul li ul,
div.menu-bar ul li:hover ul li:hover ul li:hover ul li ul,
div.menu-bar ul li:hover ul li:hover ul li:hover ul li:hover ul li ul,
div.menu-bar ul li:hover ul li:hover ul li:hover ul li:hover ul li:hover ul li ul {
display: none;
}
div.menu-bar ul li:hover ul, div.menu-bar ul li:hover ul li:hover ul,
div.menu-bar ul li:hover ul li:hover ul li:hover ul,
div.menu-bar ul li:hover ul li:hover ul li:hover ul li:hover ul,
div.menu-bar ul li:hover ul li:hover ul li:hover ul li:hover ul li:hover ul,
div.menu-bar ul li:hover ul li:hover ul li:hover ul li:hover ul li:hover ul li:hover ul {
display: block;
}
span.menu-nav:after, a.menu-nav:after {
content: "\00BB";
float: right;
margin-right: 8px;
}
</style>
</head>
<body>
<h1>CSS drop-down menu</h1>
<div class="menu-bar">
<ul>[*]
Home
[*]
JavaScript
<ul>[*]
Link
[*]
Submenu
<ul>[*]
Submenu
<ul>[*]<span onclick="alert('!');">JavaScript function</span>[*]
Submenu
<ul>[*]<span onclick="alert('!');">JavaScript function</span>[*]
Submenu
<ul>[*]<span onclick="alert('!');">JavaScript function</span>[*]Link[*]<span onclick="alert('!');">JavaScript function</span>[*]
Submenu
<ul>[*]<span onclick="alert('!');">JavaScript function</span>[*]Link[*]<span onclick="alert('!');">JavaScript function</span>[*]Link[*]Link[/list]
[*]Link[*]Link[*]Link[/list]
[/list]
[*]<span onclick="alert('!');">JavaScript function</span>[*]Link[*]Link[*]Link[*]Link[/list]
[*]Link[*]<span onclick="alert('!');">JavaScript function</span>[/list]
[/list]
[*]
CSS
<ul>[*]
Submenu
<ul>[*]Link[*]Link[*]Link[/list]
[*]
<span onclick="alert('!');">JavaScript function</span>
[*]
Submenu
<ul>[*]<span onclick="alert('!');">JavaScript function</span>[*]<span onclick="alert('!');">JavaScript function</span>[*]Link[/list]
[*]
Link
[*]
Link
[/list]
[*]
<span>Documents</span>
<ul>[*]
Submenu
<ul>[*]<span onclick="alert('!');">JavaScript function</span>[*]Link[*]<span onclick="alert('!');">JavaScript function</span>[*]Link[*]Link[*]Link[*]Link[/list]
[*]
Submenu
<ul>[*]Link[*]Link[*]<span onclick="alert('!');">JavaScript function</span>[/list]
[*]
Link
[/list]
[*]
<span>About Us</span>
<ul>[*]
<span onclick="alert('!');">JavaScript function</span>
[/list]
[/list]
</div>
[ Page content here ]</p>
</body>
</html>