html - Need help getting a button with a drop-down menucontent in it to be centered and to push content down - Stack Overflow
- c - Solaris 10 make Error code 1 Fatal Error when trying to build python 2.7.16 - Stack Overflow 推荐度:
- javascript - How to dismiss a phonegap notification programmatically - Stack Overflow 推荐度:
- javascript - Get the JSON objects that are not present in another array - Stack Overflow 推荐度:
- javascript - VS 2015 Angular 2 import modules cannot be resolved - Stack Overflow 推荐度:
- javascript - Type 'undefined' is not assignable to type 'menuItemProps[]' - Stack Overflow 推荐度:
- 相关推荐
I am trying to get a clickable button with a drop-down menu to be centered horizontally on my page and also to have it push down content below it when my webpage is in mobile view. When I try display: flex;
, flex-direction: column;
the "table of contents" button is centered, but there is a space where the content would fill up even though the button is in a closed state with none of the content showing. When I look at the dev tools, the div that the button is in takes up the space of the content regardless if it is closed or not. The only way I figured out to get the button to take up the appropriate space when it is closed is to give it a position: absolute;
but the content now appears over my other content rather than pushing the content down. Any help or suggestions?
.main-article {
align-items: start;
display: grid;
gap: 1rem;
grid-template-columns: 1fr 2fr 1fr;
}
.button-link {
background: none;
border: none;
text-decoration: none;
color: var(--clr-neutral-400);
font-family: inherit;
font-size: inherit;
cursor: pointer;
padding: 0;
text-align: center;
}
.dropdown.active>.menu-link,
.menu-link:hover {
color: var(--clr-primary-400);
}
.dropdown {
position: relative;
}
.dropdown-menu {
position: absolute;
left: 0;
top: calc(100% + .25rem);
background-color: var(--clr-neutral-100);
padding: .75rem;
border-radius: .25rem;
box-shadow: 0 2px 5px 0 rgb(0, 0, 0, .1);
opacity: 0;
pointer-events: none;
transform: translateY(-10px);
transition: opacity 150ms ease-in-out, transform 150ms ease-in-out;
}
.dropdown.active>.button-link+.dropdown-menu {
opacity: 1;
transform: translateY(0);
pointer-events: auto;
}
@media (max-width: 48rem) {
.main-article {
display: grid;
gap: 0.5rem;
grid-template-columns: 1fr;
}
}
@media (max-width: 48rem) {
.dropdown {
display: flex;
flex-direction: column;
}
}
My website with the issue that I am having
- 千万别反悔 库克称苹果不会推出变形本
- Mac电脑与PC九大区别
- The uid generator is giving negative value(-8201645565344219221) and using this implementation DefaultUidGenerator.java to gener
- excel - When loading my userform i get Run-Time Error 381: Could not set the list property. Invalid property array index - Stack
- swift - Load Flutter assets in iOS - Stack Overflow
- unity game engine - After commit to git, all gameobjects loose their assets - Stack Overflow
- How to Interact with iframe in Google Form “add file” feature Using Python and Playwright? - Stack Overflow
- batch file - Command segment in .omp.json Oh-my-posh theme - Stack Overflow
- reactjs - why react dev tools paint highlights to components in this example - Stack Overflow
- c++ - Microbenchmark - backward iteration results in fewer cache misses - Stack Overflow
- javascript - Unable to locate tests within a folder - Stack Overflow
- visual studio code - VSCode support fully integrated IPython terminal - Stack Overflow
- Deploying Angular App on Azure SWA with SCSS Issues - Stack Overflow
- postgresql - AzureStorageClient raises the error Unable to determine account name for shared key credential - Stack Overflow
- outlook - Unable to send email using Microsoft Graph API: Error 550 5.7.708 - Stack Overflow
- GHC unable to find mingwinclude directory on Windows - Stack Overflow
- amazon web services - Nuxt build fails on AWS Amplify: Failed to find the deploy-manifest.json file in the build output - Stack