1
0
mirror of https://github.com/phuoc-ng/csslayout.git synced 2025-10-23 10:46:13 +02:00
Files
csslayout/styles/patterns/_nested-dropdowns.scss
2022-09-22 10:04:06 +07:00

65 lines
1.2 KiB
SCSS

.nested-dropdowns {
/* Border */
border: 1px solid #d1d5db;
display: flex;
/* Reset list styles */
list-style-type: none;
margin: 0;
padding: 0;
}
.nested-dropdowns li {
cursor: pointer;
/* Spacing */
padding: 0.25rem;
/* Used to position the sub nested-dropdowns */
position: relative;
}
/* The sub nested-dropdowns */
.nested-dropdowns ul {
/* Border */
border: 1px solid #d1d5db;
/* Hidden by default */
display: none;
/* Absolute position */
left: 0;
position: absolute;
top: 100%;
/* Reset styles */
list-style-type: none;
margin: 0;
padding: 0;
}
/* The second level sub nested-dropdowns */
.nested-dropdowns ul ul {
left: 100%;
position: absolute;
top: 0;
}
/* Change background color of list item when being hovered */
.nested-dropdowns li:hover {
background-color: rgba(0, 0, 0, 0.1);
}
/* Show the direct sub nested-dropdowns when hovering the list item */
.nested-dropdowns li:hover > ul {
display: block;
}
/* Demo */
.nested-dropdowns__item {
align-items: center;
display: flex;
}
.nested-dropdowns__arrow {
margin-left: 0.25rem;
}