1
0
mirror of https://github.com/phuoc-ng/csslayout.git synced 2025-10-24 11:16:27 +02:00

feat: Mega menu

This commit is contained in:
Phuoc Nguyen
2022-09-22 09:44:29 +07:00
parent fe219f7c79
commit fb543b5cec
7 changed files with 143 additions and 245 deletions

View File

@@ -57,6 +57,7 @@
@import './patterns/lined-paper';
@import './patterns/masonry-grid';
@import './patterns/media-object';
@import './patterns/mega-menu';
@import './patterns/menu';
@import './patterns/modal';
@import './patterns/notification';

View File

@@ -0,0 +1,64 @@
.mega-menu {
align-items: center;
display: flex;
justify-content: center;
position: relative;
border: 1px solid #d1d5db;
border-radius: 0.25rem;
/* Demo */
width: 100%;
}
.mega-menu__item {
display: flex;
align-items: center;
height: 100%;
flex: 1;
padding: 0.25rem 0.5rem;
}
.mega-menu__item:not(:last-child) {
border-right: 1px solid #d1d5db;
}
.mega-menu__trigger {
cursor: pointer;
/* Demo */
height: 2rem;
align-items: center;
display: flex;
justify-content: center;
}
.mega-menu__content {
/* Border */
border: 1px solid #d1d5db;
// margin-top: -1px;
/* Hidden by default */
display: none;
/* Position it right below the trigger element */
left: 0;
padding-top: 0.25rem;
position: absolute;
top: 100%;
/* Take full width */
width: 100%;
/* It should be on the top of other elements */
background-color: #fff;
z-index: 9999;
}
/* Show the mega menu when hovering the trigger item */
.mega-menu__trigger:hover .mega-menu__content {
display: block;
}