Last active
November 25, 2025 19:38
-
-
Save dieseltravis/b57aa8579863c69f019270547cc8141f to your computer and use it in GitHub Desktop.
CSS Plus and Minus via https://jsfiddle.net/mzvarik/wt3upz4q/
This file contains hidden or 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
| body { | |
| padding:40px; | |
| --size: 5vw; | |
| --margin: 1vw; | |
| --stroke: 2px; | |
| } | |
| .expander{ | |
| border: 1px solid #000; | |
| width: var(--size); | |
| height: var(--size); | |
| border-radius: 100%; | |
| position: relative; | |
| margin: 4px; | |
| display: inline-block; | |
| vertical-align: middle; | |
| cursor: pointer; | |
| } | |
| .expander:before, | |
| .expander:after{ | |
| content:'';position:absolute;top:0;left:0;right:0;bottom:0; | |
| } | |
| /* PLUS */ | |
| .collapsed .expander:before, | |
| .expander:after { | |
| background:#000; | |
| } | |
| .collapsed .expander:before{ | |
| width: var(--stroke); | |
| height: calc(100% - var(--margin) - var(--margin)); | |
| margin: var(--margin) auto; | |
| } | |
| .collapsed .expander:after, | |
| /* MINUS */ | |
| .expander:after{ | |
| margin: auto var(--margin); | |
| height: var(--stroke); | |
| } |
This file contains hidden or 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="expandable-content collapsed"> | |
| <div class="expander"></div> | |
| plus | |
| </div> | |
| <div class="expandable-content"> | |
| <div class="expander"></div> | |
| minus | |
| </div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment