odin-default-css-exercises/animation/02-drop-down/solution/solution.css

66 lines
1.1 KiB
CSS
Raw Normal View History

2021-10-17 21:56:50 +00:00
* {
padding: 0;
2021-10-17 21:43:06 +00:00
margin: 0;
2021-10-17 21:56:50 +00:00
font-family: Arial, Helvetica, sans-serif;
2021-10-17 21:43:06 +00:00
}
.dropdown-container {
width: 100vw;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}
.dropdown-menu {
position: relative;
}
2021-10-17 22:17:42 +00:00
button {
2021-10-17 21:43:06 +00:00
background-color: rgb(108, 238, 255);
padding: 16px;
font-size: 16px;
border: none;
}
2021-10-17 21:56:50 +00:00
ul {
2021-10-17 21:43:06 +00:00
position: absolute;
left: -25%;
background-color: rgb(189, 188, 188);
width: 160px;
2021-10-17 21:56:50 +00:00
list-style: none;
text-align: center;
2021-10-17 21:43:06 +00:00
}
2021-10-17 21:56:50 +00:00
li {
padding: 16px;
2021-10-17 21:43:06 +00:00
}
2021-10-17 22:17:42 +00:00
/* SOLUTION */
/* disclaimer: duplicating the `ul` element here isn't best practice.
In your solution you probably put it right inside the existing `ul`,
which _is_ the best practice.
We separated it out here to make it extra clear what has changed. */
ul {
overflow: hidden;
max-height: 0;
transition: max-height 0.25s ease-out;
}
2021-10-17 21:56:50 +00:00
.dropdown-menu:hover ul {
max-height: 500px;
transition: max-height 0.5s ease-out;
2021-10-17 21:43:06 +00:00
}
2021-10-17 22:17:42 +00:00
button:hover {
2021-10-17 21:43:06 +00:00
cursor: pointer;
background-color: rgb(59, 232, 255);
}
2021-10-17 22:17:42 +00:00
ul li:hover {
2021-10-17 21:56:50 +00:00
cursor: pointer;
2021-10-17 21:43:06 +00:00
background-color: #ddd;
}