mirror of
https://github.com/expressjs/expressjs.com.git
synced 2026-02-21 19:41:33 +00:00
Eliminate layout shift in menu toggle arrow with CSS-only solution (#1935)
refactor menu toggle arrow
This commit is contained in:
@@ -1130,6 +1130,19 @@ h2 a {
|
||||
color: #000;
|
||||
background-color: #fff;
|
||||
|
||||
&::after {
|
||||
content: "";
|
||||
display: block;
|
||||
width: 0.8em;
|
||||
height: 0.5em;
|
||||
background-color: var(--card-bg);
|
||||
clip-path: polygon(100% 0%, 0 0%, 50% 100%);
|
||||
cursor: pointer;
|
||||
pointer-events: none;
|
||||
transition: transform 0.2s ease-in-out;
|
||||
transform: rotate(-90deg);
|
||||
}
|
||||
|
||||
&:is(:hover, :active, :focus) {
|
||||
background-color: #ebf2f5;
|
||||
}
|
||||
@@ -1331,10 +1344,16 @@ h2 a {
|
||||
}
|
||||
|
||||
#menu-toggle.show {
|
||||
display: block;
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
align-items: center;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
#menu-toggle.show.rotate::after {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
|
||||
#menu > li > a,
|
||||
#menu ul a {
|
||||
padding: 0.5rem;
|
||||
|
||||
Reference in New Issue
Block a user