This is a solution to the Pricing component with toggle challenge on Frontend Mentor. Frontend Mentor challenges help you improve your coding skills by building realistic projects.
Users should be able to:
- View the optimal layout for the component depending on their device's screen size
- Control the toggle with both their mouse/trackpad and their keyboard
- Bonus: Complete the challenge with just HTML and CSS
- Solution URL: Frontend Mentor
- Live Site URL: Github Pages
- Semantic HTML5 markup
- CSS custom properties
- Flexbox
- CSS Grid
- Mobile-first workflow
I tried to style the checkbox with minimal code and markup, basically just adding the class 'toggle' to a standard checkbox (no label or dummy elements needed) and have the minimal JS to make it work. It came out ok I think.
I'll come back to this later and try to do it without JS. The spacing is a little off in places too and looks cramped with the bigger numbers.
- Website - Grant Ramsay
- Frontend Mentor - @seapagan
- Twitter - @gnramsay_dev