Last active
May 1, 2022 09:49
-
-
Save WesleySmits/833e73d877292ae1bf65ac2d559540a6 to your computer and use it in GitHub Desktop.
Accessible Accordion: Basic accordion styling
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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