Created
June 2, 2021 17:01
-
-
Save mikeoberdick/338f551810c07bd2767abc380cf29a79 to your computer and use it in GitHub Desktop.
Morph a plus icon into a minus icon for accordians and menus
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
/* | |
<div class = "plus-to-minus"> | |
<span></span> | |
<span></span> | |
</div> | |
*/ | |
.question-container { | |
.plus-to-minus { | |
width: 50px; | |
height: 50px; | |
font-size: 1.5em; | |
position: relative; | |
span { | |
position: absolute; | |
transition: 300ms; | |
background: $purple; | |
border-radius: 2px; | |
&:first-child { | |
top: 25%; | |
bottom: 25%; | |
width: 10%; | |
left: 45%; | |
} | |
&:last-child { | |
left: 25%; | |
right: 25%; | |
height: 10%; | |
top: 45%; | |
} | |
} | |
} | |
a[aria-expanded="true"] { | |
.plus-to-minus { | |
span { | |
transform: rotate(90deg); | |
&:last-child { | |
left: 50%; | |
right: 50%; | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment