Design comparison
SolutionDesign
Solution retrospective
Is there a better way to create round buttons with a dynamic width ? What I did feels a bit hacky
Community feedback
- @stijnmeershoekPosted about 2 years ago
if you want a button width a dynamic width that is a perfect circle you will probably want to use this:
button { width: ?; // your dynamic width probably % or vw aspect-ratio: 1 / 1; // auto adjusts the height to the same as the width to keep it as a square border-radius: 50%; // rounds it fully to a circle; }
Marked as helpful0
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord