-
Notifications
You must be signed in to change notification settings - Fork 0
/
dropmenu_02.html
72 lines (64 loc) · 1.66 KB
/
dropmenu_02.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>Drop Menu: Step 2</title>
<link rel="stylesheet" href="css/dropmenu.css">
<style type="text/css">
dl.drop-menu
{
position: absolute;
left: 50%;
margin-top: 30px;
margin-left: -80px;
z-index: 1;
}
dl.drop-menu dd
{
display: none;
}
dl.drop-menu:hover dd
{
display: block;
}
</style>
</head>
<body>
<nav>
<dl class="drop-menu">
<dt>Days of the Week</dt>
<dd>Monday</dd>
<dd>Tuesday</dd>
<dd>Wednesday</dd>
<dd>Thursday</dd>
<dd>Friday</dd>
<dd>Saturday</dd>
<dd>Sunday</dd>
</dl>
</nav>
<section>
<p>A CSS Drop Menu.</p>
</section>
<script>
/* DROP-CSS
*
* Not all CSS properties can be transitioned, but usually those properties with numeric values can.
*
* 1. Since the "display" property can't be transitioned, substitute the property margin-top instead:
*
* dl.drop-menu dd { margin-top: -25px; }
* dl.drop-menu:hover dd { margin-top: -1px; }
*
* 2. This doesn't completely hide the menu (yet), but it does allow us to see everything while we build.
* 3. Now add the transition rules to the dl.drop-menu dd selector as so:
transition-property: margin-top;
transition-duration: 300ms;
transition-timing-function: ease;
* 4. CSS transition rules are just like any other CSS rules except that they introduce a time element.
* 5. Test this in the browser. Try different values for duration and easing.
* 6. Note that rules can also be added to the :hover set. These will describe the transition when that is triggered.
*
*/
</script>
</body>
</html>