Professional Documents
Culture Documents
CSS (Media Type, Drop-Down Menus..)
CSS (Media Type, Drop-Down Menus..)
menus..
•
Media Types
all:
Used for all media type devices
speech:
Matches screen readers and other devices that read out the
content of a page.
print:
Used for printers
screen:
Matches all devices that aren't matched by print or speech.
Deprecated Media Types
Screen, tty, tv, handheld, embossed, and braille.
Example
.dropdown:hover .dropdown-content {
display: block;
}
9/1/21
Example 2
.dropbtn {
background-color: #4CAF50;
color: white;
padding: 16px;
font-size: 16px;
border: none;
cursor: pointer;
}
9/1/21
/* Dropdown Content (Hidden by Default) */ /* Change color of dropdown links on hover */
.dropdown-content { .dropdown-content a:hover {background-color: #f1f1f1}
display: none;
position: absolute; /* Show the dropdown menu on hover */
background-color: #f9f9f9; .dropdown:hover .dropdown-content {
min-width: 160px; display: block;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); }
z-index: 1;
} /* Change the background color of the dropdown button
when the dropdown content is shown */
/* Links inside the dropdown */ .dropdown:hover .dropbtn {
.dropdown-content a { background-color: #3e8e41;
color: black; }
padding: 12px 16px;
text-decoration: none;
display: block;
}
9/1/21
<div class="dropdown">
<button class="dropbtn">Dropdown</button>
<div class="dropdown-content">
<a href="#">Link 1</a>
<a href="#">Link 2</a>
<a href="#">Link 3</a>
</div>
</div>
9/1/21