Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WesleySmits/833e73d877292ae1bf65ac2d559540a6 to your computer and use it in GitHub Desktop.
Save WesleySmits/833e73d877292ae1bf65ac2d559540a6 to your computer and use it in GitHub Desktop.
Accessible Accordion: Basic accordion styling
details {
--curtain-border-color: #334455;
--curtain-background-color: #223344;
--curtain-color: #ffffff;
max-width: 30rem;
border: 1px solid var(--curtain-border-color);
color: var(--curtain-color);
overflow: hidden;
}
summary {
position: relative;
display: block;
padding: 1rem 3.5rem 1rem 1rem;
background: var(--curtain-background-color);
}
summary::-webkit-details-marker {
display: none;
}
summary:focus {
outline: none;
box-shadow: inset 0 0 0.25em 0.125em #08f;
}
summary:after {
content: "";
position: absolute;
top: 1.375rem;
right: 1rem;
display: inline-block;
vertical-align: top;
width: 0;
height: 0;
border: 0.5rem solid transparent;
border-top-color: #ffffff;
border-bottom-width: 0;
transition: transform 0.5s;
}
details[open] summary:after {
transform: rotateX(180deg);
}
.curtain__content {
padding: 1rem;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment