Skip to content

Instantly share code, notes, and snippets.

@davepermen
Last active October 9, 2023 15:09
Show Gist options
  • Save davepermen/ea732ed05d80f643149b0e692d4ac466 to your computer and use it in GitHub Desktop.
Save davepermen/ea732ed05d80f643149b0e692d4ac466 to your computer and use it in GitHub Desktop.
modern menu
<!DOCTYPE html>
<meta name="robots" content="noindex">
<html>
<head>
<meta charset="utf-8">
<link rel="manifest" href="/site.webmanifest">
<meta name="viewport" content="width=device-width">
<link href="site.css" rel="stylesheet" />
</head>
<body>
<section id='user-account-menu'>
<button popovertarget='user-account-menu-dropdown'>☰</button>
<menu id='user-account-menu-dropdown' popover>
<button popovertarget='user-account-menu-dropdown'>✕</button>
<li>dave</li>
<li>logout</li>
</menu>
</section>
</body>
</html>
* {
margin: 0;
padding: 0;
appearance: none;
border: 0;
list-style-type: none;
font-size: inherit;
}
html {
font-size: 1rem;
font-family: monospace;
width: 100%;
height: 100%;
background: #333;
}
#user-account-menu {
position: absolute;
--height: 2rem;
width: 2rem;
right: calc(100% - env(titlebar-area-width, 100%) - env(titlebar-area-left, 0%));
transition: all 0.33s linear;
& button {
background: lightgreen;
height: var(--height);
line-height: 1;
aspect-ratio: 1;
position: absolute;
width: 2rem;
right: 0;
transition: all 0.33s linear;
&:hover {
box-shadow: 0 0 1rem lightgreen;
}
}
> button {
display: block;
left: auto;
right: 0;
}
> menu {
left: auto;
right: calc(100% - env(titlebar-area-width, 100%) - env(titlebar-area-left, 0%));
background: transparent;
filter: drop-shadow(0 0 0.25rem black) drop-shadow(0 0 0.5rem black) drop-shadow(0 0 1rem black) drop-shadow(0 0 2rem black);
opacity: 0;
transition: all 0.33s linear, display 0.33s allow-discrete;
&:popover-open {
@starting-style {
opacity: 0;
}
opacity: 1;
}
}
> menu li {
background: lightgreen;
height: 2rem;
line-height: 2rem;
padding-inline: 2ch;
}
> menu li:first-of-type {
margin-top: var(--height);
}
}
{
"name": "Files by Conesoft",
"short_name": "Files",
"icons": [
{
"src": "/icons/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/icons/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
],
"theme_color": "#000000",
"background_color": "#000000",
"start_url": "https://files.conesoft.net",
"scope": "/",
"display": "standalone",
"display_override": [ "window-controls-overlay" ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment