-
Notifications
You must be signed in to change notification settings - Fork 425
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dropdown is not vertically aligned with <a>
in <nav>
#498
Comments
<nav>
<a>
in <nav>
This seems to be caused by the height being set manually but calculating incorrectly. The current version as shown in the reproduction URL does not account for the border decreasing the size of the content box or something like that. Here's one of the places the height is set: nav details.dropdown summary:not([role]) {
height: calc(1rem * var(--pico-line-height) + var(--pico-nav-link-spacing-vertical) * 2);
padding: calc(var(--pico-nav-link-spacing-vertical) - var(--pico-border-width) * 2) var(--pico-nav-link-spacing-horizontal);
} We can note that the height is set manually and accounts for both I'm not sure the exact reason as there seems to be a bit of negative margins or other shenanigans used on the nav details.dropdown summary:not([role]) {
height: calc(1rem * var(--pico-line-height) + var(--pico-nav-link-spacing-vertical) * 2 - 2 * var(--pico-border-width));
} I'm not able to look into this further myself, so I hope this helps anyone looking into this later! |
This issue hasn't seen much updates, but I can confirm that the weird rendering is only present in Firefox, rather than Chrome (and Safari). |
Confirm that there is offsets in dropdown! Tested Firefox and Brave. It is even worse in mobile Firefox. |
Setting a fixed height seems like the wrong approach to me. |
Describe the issue
A dropdown in a
<nav>
is slightly misaligned with an anchor in the nav. The text of the dropdown is also slightly misaligned even after aligning the outlines.Current Behavior
Expected Behavior
Reproduction URL
https://picocss.com/docs/nav#dropdowns (I added
style="outline: 1px solid red;"
on the<a>
and<summary>
.)Environment
Firefox on Windows 10
The text was updated successfully, but these errors were encountered: