CSS Dropdown Menu
Use CSS to create a dropdown menu that appears when the mouse hovers over an element.
Dropdown Menu Examples
Example 1
Text Dropdown Menu
Runoob Tutorial
www.runoob.com
Example 2
Runoob Tutorial 1
Runoob Tutorial 2
Runoob Tutorial 3
Example 3
What you learn is not only technology, but also a dream!
Basic Dropdown Menu
When the mouse moves over a specified element, a dropdown menu appears.
Example
<
style
.dropdown
{
position:
relative
;
display:
inline-block
;
}
.dropdown-content
{
display:
none
;
position:
absolute
;
background-color:
#f9f9f9
;
min-width:
160
px
;
box-shadow:
0
px
8
px
16
px
0
px
rgba
(
0
,
0
,
0
,
0.2
)
;
padding:
12
px
16
px
;
}
.dropdown
:hover
.dropdown-content
{
display:
block
;
}
style
<div class="dropdown">
<span>
Hover over me!
span
<div class="dropdown-content">
<p>
Runoob Tutorial
p
<
p
www.runoob.com
p
div
div
Try it »
Example Parsing
HTML Part:
We can use any HTML element to open the dropdown menu, such as, or a